第三方控件netadvantage UltraWebGrid如何生成带加号多级表数据也就是带子表

1.看代码不解释:

       ds.Relations.Add("fk", ds.Tables[0].Columns["Id"], ds.Tables[1].Columns["ParentCardId"], false);

   将父表和子表放到dataset中通过设置外键关联,这样就会自动绑定上。由于某些原因表不允许自动生成列,这是子表就要手动在后台设置:

  band[1]就是指的子表;

   protected void UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)

{

    if (this.UltraWebGrid1.Bands[1] != null)
        {
            this.UltraWebGrid1.Bands[1].Columns.Add("PerName", " 姓名");
            this.UltraWebGrid1.Bands[1].Columns.FromKey("PerName").HeaderText = "姓名";
            this.UltraWebGrid1.Bands[1].Columns.FromKey("PerName").BaseColumnName = "PerName";

         }

}

原文地址:https://www.cnblogs.com/guozefeng/p/3218118.html