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
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:
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label1" runat="server"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Visible="False"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
After that, and if you want, you can find the textbox and toggle its visibility from code behind.
Use FindControl within the Cell of the Row that you added the Control:
GridView1.Rows(0).Cells(cellindex).FindControl("txtSchedule" & cellindex.ToString)