forum

Home / DeveloperSection / Forums / Object Reference is not set to an instance of an object error in my code

Object Reference is not set to an instance of an object error in my code

Anonymous User 1927 14-Nov-2013
protected void ImageButton_enable_Click(object sender,ImageClickEventArgs e)    
    {
        foreach(GridViewRow gvrow in GridView_enable.Rows)
        {
            CheckBoxchk1=(CheckBox) gvrow.FindControl("CheckBoselect");
            if(chk1.Checked == true)
            {
                Label lblEmail = (Label)gvrow.FindControl("Label1");
                string email = lblEmail.Text;
            }
         }          
    }
What is wrong in my code? i am getting this error "Object Reference is not set to an instance of an object".

c# c# 
Updated on 14-Nov-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By