【问题标题】:How to access a child datagrid which is inside of another datagrid, before it's not binded如何在未绑定之前访问另一个数据网格内部的子数据网格
【发布时间】:2011-03-07 04:31:47
【问题描述】:

我有一个嵌套的数据网格。我想获取子数据网格的标题文本,bifore 绑定过程。

有没有办法做到这一点?

【问题讨论】:

    标签: c# asp.net datagrid


    【解决方案1】:

    您可以连接到ItemDataBound event。在这里,您可以 FindControl() 为您的嵌套 DataGrid 动态绑定它。

    protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
    {
        DataGrid child = e.Item.FindControl("theNestedGrid") as DataGrid;
        if(child != null)
        {
             // Binding logic here
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2012-02-17
      • 2013-03-28
      • 1970-01-01
      • 2022-01-03
      • 1970-01-01
      • 1970-01-01
      • 2011-09-22
      • 1970-01-01
      • 2011-04-23
      相关资源
      最近更新 更多