Skip to content
Loading
  • 0
    I could be wrong BUT everywhere you use an int value to append to a string value, example: _txtCode.ID = "txtEnqqNo" + i;
     
    you do not convert the int value to a string value so when you  go to find the control you are looking for it does not exist.
     
    In this case - TextBox tb = (TextBox)enqPanel.FindControl("txtEnqqNo" + k);
    k is an int value, you are asking to find "txtEnqqNo", a string value.
     
    Because you do not convert k to a string value, the FindControl is effectively looking for "txtEnqqNo" which does not exist therefore I am guessing that is why you are getting a null value error
     
    try something like _txtCode.ID = "txtEnqqNo" + i.ToString();
    0