ASP.NET - object refernece error - Asked By msakt on 19-Jun-12 01:24 AM
this code write in rowedit
int row = e.NewEditIndex;
lblMembersCount.Text = gvUploadedData.DataKeys[row]["ICDRegularMemberID"].ToString();
in gridview icdregularmemberid have value ..but here throw object reference error occure
Jitendra Faye replied to msakt on 19-Jun-12 01:30 AM
First debug your code , because it may be possible that you are getting null value for gvUploadedData.DataKeys[row]["ICDRegularMemberID"]
check what is the value of this.
S K replied to msakt on 19-Jun-12 01:49 AM
object refernece error is very common error when you are missing anyting in code like if there no object which you are trying to get access suppose in you code the column ICDRegularMemberID are not binding and you are trying to access it than you get such type of error this is one possibility may be there was other missing thing so you need to debug your code you will get actual problem
DL M replied to msakt on 19-Jun-12 02:03 AM
Most of this error represent you handling null values,just check your database query returning any null values or if you implicitly assign any null values.
dipa ahuja replied to msakt on 19-Jun-12 03:32 AM
In Most cases this error comes when an object is trying to access a null object. so to access the object which is null (not exist in memory) can cause the error that object reference not set to an instance of an object.