Thursday, October 12, 2006

Xceed Grid Check box Column and Single Click Edit

In some cases we need to put a column with check box, so that we can select some row with check box. And then perform some operation depending on check box value. Xceed provide a very simple and easy way to accomplish this task. All you need to do is to add a column and set is data type to bool that’s it you are done.


grid.Columns.Add( new Column( "CHECKBOX", typeof( bool ) ) );

grid.Columns["CHECKBOX"].Title = "";

grid.Columns["CHECKBOX"].Width = 100;

grid.Columns["CHECKBOX"].Fixed = true;//XceedGrid 3.1


Now how do you set or get checked state from the column. Well when creating a new data row you simple put true or false to the value of the cell. If you assign false the checkbox will be unchecked and vice versa.


//setting values

Xceed.Grid.DataRow row = this.grid.DataRows.AddNew();

row.Cells["CHECKBOX"].Value = false;

foreach(DataRow row in grid.DataRows)

if((bool)row.Cells["CHECKBOX"].Value == true)


//do some work


No comments:

Post a Comment