Reputation: 1171
I have a gridview to which I am allocating a data source and binding it on Button Click in Code behind.
Code:
protected void Button2_Click(object sender, EventArgs e)
{
GridView1.DataSource=List;
GridView1.DataBind();
}
asp.net
It was working fine until I decided to put this grid view inside a tab panel. As soon as I put the gridview inside the tab it is not able to access the gridview.
I tried using FindControl to find GridView3 but its not working.
Can somebody suggest me a work around?
Thanks
Upvotes: 1
Views: 1139
Reputation: 592
try looping over all the containers in tab-panel:
foreach(var c in tab_panel.Controls)
{
if(c is your control)
return c;
if(c is a container)
loop through all controls in c;//recursion
}
Upvotes: 1