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
close icon

Problem adding values to a column

Hi,
I want to do something like the following so I can use an unbound column to hold the row number for a DataSet.Tables["table"].rows.count iteration. I need to use this column as a key source in QueryCellInfo handler. Can you help me please?

for(int i=1; i{
this.myGrid[i, 1].CellValue = i; ?????
}

2 Replies

AD Administrator Syncfusion Team December 8, 2006 09:55 AM UTC

Take a look at the Grid\Samples\DataBound\MultiHeader sample. It adds an unbound checkbox on the left side and an unbound column on the right side.

The steps are:

1) Add a GridBoundColumn in the GridBoundColumns collection (or Binder.InternalColumns if you have not explicitly added GridBoundColumns). In the sample, search for "Unbound" to see this code.

2) Add some datastructure to hold the data that is to occupy this column. The sample uses a HashTable unboundValues. But you can use any structure you desire.

3) Handle the GridDataBoundGrid.Model.QueryCellInfo event to provide the values to the grid from your second DataTable for your unbound column. See ModelQueryCellInfo in the sample.

4) Handle the GridDataBoundGrid.Model.SaveCellInfo event to save the values from the unbound column to the Hashtable (or whatever object you are using to hold the unbound values). See ModelSaveCellInfo in the sample.


AD Administrator Syncfusion Team December 8, 2006 02:43 PM UTC

Thank you - that put me in the right direction.

Loader.
Live Chat Icon For mobile
Up arrow icon