We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

add aditional column

When I fill a grid with data from dataset, and then I want to add some more data, and ofcourse in new columns, grid erase my previous data and put that new data instead. Why? How can I prevent this?

1 Reply

AD Administrator Syncfusion Team July 12, 2005 08:53 AM UTC

Are you trying to add new columns to your DataTable that is the grid''s DataSource? Or, are you trying to add unbound columns where the data does not come from the DataTable that is the grid''s DataSource? Here is button handler code that does adds a column to an existing DataTable.
private void button1_Click(object sender, System.EventArgs e)
{
	//dt is the grid''s DataSource
	dt.Columns.Add("newcolumn");
	this.gridDataBoundGrid1.Binder.InitializeColumns();
	this.gridDataBoundGrid1.Refresh();
}
To use an unbound column, you add a GridBoundColumn with a name that is not a column in the DataSource. Then you handle QueryCellInfo and SaveCellInfo to provide and save teh unbound values for this column. This sample has unbound columns in it. \Syncfusion\Essential Studio\3.2.1.0\Windows\Grid.Windows\Samples\DataBound\GDBGMultiHeader

Loader.
Up arrow icon