Can't Find Controls in GridView on Dynamic Controls

前端 未结 2 375
情书的邮戳
情书的邮戳 2021-01-28 19:45

I have a gridview where I add textboxes to everycell on runtime. However, I can\'t seem to access those controls using findcontrol

Here is how I add the tex

2条回答
  •  暖寄归人
    2021-01-28 20:03

    The dynamically added textbox doesn't exist in fact. Thus, you cannot access or find it. You can add your textbox physically inside the grid TemplateField and set its visibility to false like the code segment below:

    
       
                               
          
       
    
    

    After that, and if you want, you can find the textbox and toggle its visibility from code behind.

提交回复
热议问题