[英]Not able to access gridview inside tab panel from code behind asp.net
I have a gridview to which I am allocating a data source and binding it on Button Click in Code behind. 我有一个gridview,我要向其分配数据源并将其绑定到“单击按钮”中的后面的代码中。
Code: 码:
protected void Button2_Click(object sender, EventArgs e)
{
GridView1.DataSource=List;
GridView1.DataBind();
}
asp.net 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.
一旦将gridview放入选项卡中,它就无法访问gridview。
I tried using FindControl to find GridView3 but its not working. 我尝试使用FindControl查找GridView3,但无法正常工作。
Can somebody suggest me a work around? 有人可以建议我解决吗?
Thanks 谢谢
您是否尝试过: TabPanel.Children?
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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.