Am running asp.net application with c#.Am using gridview to update and delete the columns.deleting is working fine.if am clicking the update button i got
System.NullReferenceException: Object reference not set to an instance of an object.
My code is;
protected bool IsRowModified(GridViewRow row)
{
int currentID;
string currentName;
string currentLocation;
currentID = Convert.ToInt32(GridView1.DataKeys
[row.RowIndex].Value);
currentName = ((TextBox)row.FindControl
("txtName")).Text;
currentLocation = ((TextBox)row.FindControl
("txtLocation")).Text;
**System.Data.DataRow newRow = originalTable.Select
(String.Format("ID = {0}", currentID))[0];** //got error in this line
if (!currentName.Equals(newRow["Name"].ToString()))
{ return true; }
if (!currentLocation.Equals(newRow["Location"].ToString()))
{ return true; }
return false;
}