简体   繁体   English

无法从asp.net背后的代码访问选项卡面板内的GridView

[英]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.

相关问题 如何访问文本框,使用asp.net Web表单从代码后面的更新面板内标签 - How to access textbox, label inside update panel from code behind using asp.net web forms 在asp.net中,要启用/禁用图像按钮,如何在asp.net代码后面的文件中访问Gridview-&gt; Itemtemplate-&gt;面板的ImageButton控件 - In asp.net, To enable/disable imagebutton, How can I access ImageButton control of Gridview->Itemtemplate->panel in asp.net code behind file 将值从GridView传递到ASP.NET中文件后面的代码 - Passing values from GridView to code behind file in ASP.NET 从asp.net中的后台代码更新Gridview - Update gridview from code behind in asp.net asp.net:如何访问从后面的代码创建的表的单元格内的文本框的内容 - asp.net: how to access contents of a textbox inside the cell of a table that was created from the code behind c#从asp.net页面访问背后的代码 - c# Code behind access from asp.net page 设置文字 <p> 从c#asp.net中的代码嵌入在asp:Panel中 - Set text in <p> embedded in asp:Panel from code behind c# asp.net 代码为代码后面的 ASP.net 中的 GridView 创建排序? - Code to create Sorting for a GridView in ASP.net in Code Behind? 在asp.net的更新面板中使用gridview进行排序 - sorting with gridview inside a update panel in asp.net 如何在ASP.Net中的Div或面板内拉伸Gridview宽度 - How to Stretch Gridview width inside a Div or a Panel in ASP.Net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM