1

如何在基础设施 UltraGrid 中动态添加复选框

4

4 回答 4

4

只需确保您要绑定的列的数据类型是 bool 类型。它将自动为该列创建复选框。

于 2009-04-24T06:13:51.613 回答
1

尝试以下

 //get the data from db
 var ds = GetDataFromDatabase();

  ds.Tables[0].Columns.Add("Check", typeof(bool)); //this will create checkbox col

  foreach(Datarow row in ds.Tables[0].Rows)
  {
      row["Check"] = true; // make all rows checked just to see it works

  }


  DataView dv = ds.Tables[0].DefaultView; //set it as a dataview

  ultraGrid1.DataSource = dv; //set the dataview as the datasource for your grid
于 2013-10-18T19:01:36.410 回答
0

确保列数据类型为bool(True/False 或 0/1),然后设置:

grid.DisplayLayout.Bands[0].Columns["column_name"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox;

那应该行得通。

于 2013-09-10T09:34:09.777 回答
0

在将数据绑定到网格时,您可以通过以下查询调用数据表的集合:

“从 [TABLE_NAME] 中选择 Convert(bit,0) 作为 IsChecked,[OTHER_COLUMNS]”

这将返回一个带有第一列复选框的数据表。

使用数据源将其与您的网格绑定。

于 2016-05-20T20:37:36.780 回答