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

GridDataBoundGrid

Hello!
I need your assistance in the following:
For the GridDataBoundGrid named gridDataBoundGrid connected to a DataSource I need to know at run time:
1. What event tells me the grid finished loading all the data and the data can be accessed?
2. Given AllowResizeToFit == true, what event tells me that all columns finished resizing?
3. What is the difference between the properties gridDataBoundGrid.GridBoundColumns gridDataBoundGrid.Binder.InternalColumns ?
4. When I connect the grid to a BindingSource then gridDataBoundGrid.Model.ColCount shows the correct number of columns, identical to gridDataBoundGrid.Binder.InternalColumns.Count, however gridDataBoundGrid.GridBounColumns.Count returns 0.
When I build a Collection of GridBoundColumns in design mode, all 3 properties are identical. How can I access the columns and their properties without knowing how they were originally designed? Is there another option not mentioned above?

Many thanks in advance.

1 Reply

JJ Jisha Joy Syncfusion Team July 28, 2010 04:33 AM UTC

Hi,

Thank you for using Syncfusion products.


You could use the following code to trace out the datasource binding in GriddataBoundGrid.

CurrencyManager cm = (CurrencyManager)this.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember];

cm.BindingComplete += new BindingCompleteEventHandler(cm_BindingComplete);


You could acheive the desired behavior Model.QueryColWidth event of gridDataboundgrid.

this.gridDataBoundGrid1.Model.QueryColWidth += new GridRowColSizeEventHandler(Model_QueryColWidth);

There is a difference between InternalColumns and GridBoundColumns is whether or not you have explicitly added any GridBoundColumn objects to the GridBoundColumns collection. InternalColumns collection will hold the same columns as GridBoundColumns if you have explicitly populated GridBoundColumns.

If you have not explicitly added columns to the GridBoundColumns collection (either through the designer or through code), then the GridBoundColumns (and also grid.GridBoundColumns) will be empty even after setting the grid.DataSource property. In this case, binder.InternalColumns will automatically be populated with the columns from the DataSource at the time the grid.DataSource property is set.

If you do explicilty add GridBoundColumn objects to the GridBoundColumn collection, then both the binder.GridBoundColumns and binder.InternalColumns will reflect exactly the columns that you have added to the binder.GridBoundColumns collection. (ie., binder.InternalColumns is not automatically set to all the columns in the datasource when grid.DataSource is set).

So, you can use the GridBoundColumns collection only if it has been explicitly populated by you. You can use InternalColumns whether or not GridBoundColumns has been populated.



Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon