GridDataBoundGrid : Add button to a cell

I have a GridDataBoundGrid . Datasource is a datatable.

I want to add a column with a button in it.
Each row's last cell is a button.

what i tried but didn't work is.

_datatable.Columns.Add("Button1");
for (int i = 0; i < _datatable.Rows.Count; i++)
{

SyncfusionGridControl[i + 1, 19].CellType = "GridCellButton";


}


Any solutions ?






2 Replies

AD Administrator Syncfusion Team December 10, 2007 05:45 PM UTC

To have a column of buttons in a GridDataBoundGrid, you need to set the CellType for the GridBoundColumn associated with the particular column.

If you have explicitly created GridBoundColumns (either from code or from the designer), you would use code like:

this.gridDataBoundGrid1.GridBoundColumns["Button1"].StyleInfo.CellType = "PushButton";
this.gridDataBoundGrid1.GridBoundColumns["Button1"].StyleInfo.Description = "Push Me";



If you have not explicitly added GridBoundColumns to your grid, then you need to use code like this.

this.gridDataBoundGrid1.Binder.InternalColumns["Button1"].StyleInfo.CellType = "PushButton";
this.gridDataBoundGrid1.Binder.InternalColumns["Button1"].StyleInfo.Description = "Push Me";




GE Gert December 11, 2007 08:16 AM UTC

Works great ! Thx you !


Loader.
Up arrow icon