Error referencing label in a GridView

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmarcrum
    New Member
    • Oct 2007
    • 105

    Error referencing label in a GridView

    Hello!

    I have created a TemplateField inside my GridView and want to reference the Label which is in the first column of each row. I am getting an error everytime I debug?!

    Can anyone please tell me what I am doing wrong? Thanks in advance!

    Code:
    //Get the reference to the row
    GridViewRow gvr = (GridViewRow)(((Control)sender).NamingContainer);
    
    //Get the reference to the Evaluation Label
    Label lblEval = (Label)gvr.FindControl("lblEval");
  • jmarcrum
    New Member
    • Oct 2007
    • 105

    #2
    I will say that lblEval is Unbound and the error is:

    "Object reference not set to an instance of an object"

    Comment

    Working...