【问题标题】:Add checkbox in UltraGrid在 UltraGrid 中添加复选框
【发布时间】:2009-04-24 06:11:32
【问题描述】:

如何在 Infragistics UltraGrid 中动态添加复选框

【问题讨论】:

    标签: ultrawingrid


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      试试下面的

       //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
      

      【讨论】:

        【解决方案3】:

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

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

        应该可以的。

        【讨论】:

          【解决方案4】:

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

          “选择 Convert(bit,0) as IsChecked, [OTHER_COLUMNS] from [TABLE_NAME]”

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

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

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 2011-07-24
            • 2022-06-16
            • 2013-04-30
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多