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

Syncfusion Grid Grouping Controls, Column width setting/Resizing Problem

I am working with Syncfusion "Grid Grouping Control datagrid" , I have a dataset which contains table dynamically. I set the default view of the table of datset to the Syncfusion Datagrid Datasource property, but the Columns displayed say four columns of Table(0) doesn’t fill the whole grid. So, I wish to Know 1) How to set the width of a column present in a datagrid without using Grid Column Descriptor 2) How to make Columns width resizable to fit the datagrid in any resizing of the from 3) If this can’t happen without Grid Column Descriptor, please tell me how to use “Grid Column Descriptor” 4) Please see below, I want the four column width should sum up the width of datagrid Datgrid ---------------------------------------------------------------- Column1 | column2| column3| column4|

3 Replies

AD Administrator Syncfusion Team April 4, 2006 03:42 PM UTC

Hi Rahul, One comment is that by default, the GridGroupingControl does not support rows with individualized rowheights. To get this support, you need to add a custom GridEngine as in the SyncfusionBrowser sample C:\Program Files\Syncfusion\Essential Suite\Grouping\ResizableRows Once you have this,the code below helps you in changing the column width for column 2 this.gridGroupingControl1.TableControl.Model.ColWidths[2] = 100; To resize all the columns, this.gridGroupingControl1.TableControl.Model.ColWidths.ResizeToFit(GridRangeInfo.Table()); Let us know if you need more information. Thanks, Rajagopal


RS Rahul Sharma April 5, 2006 11:50 AM UTC

1) I m having a tree view and a datagrid. My task is to fill datagrid as per the item selected in tree view. 2)After assinging datasource to datgrid, I am setting width of columns as per table fetched from dataset. 3) It works perfect with very first table, but when the dataset again gets filled with another table having different numbers of columns it gives error "System.ArgumentOutOfRangeException at "Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor.get_Item(Int32 index)"" 4)For same tables with same no. of column as per first, columns are coming as per width but empty Code Snippet ''Get Table as Per Selected Tree Node dsLoadAssetToGrid = clsSqlDatabase.GetDataSetFromStoredProcedure(cmdLoadAssetToGrid) dgAssetLocator.DataSource = dsLoadAssetToGrid.Tables(0).DefaultView ''Set The width of the Columns per Datagrid Width For intColumns = 0 To dsLoadAssetToGrid.Tables(0).Columns.Count - 1 ''Giving Error On this Line dgAssetLocator.TableDescriptor.Columns(intColumns).Width = dgAssetLocator.Width / dsLoadAssetToGrid.Tables(0).Columns.Count Next


AD Administrator Syncfusion Team April 7, 2006 06:10 AM UTC

Hi Rahul, Sorry for the delayed response. After setting the new data source try calling dgAssetLocator.TableDescriptor.ResetColumns() to see if that helps. ''Get Table as Per Selected Tree Node dsLoadAssetToGrid = clsSqlDatabase.GetDataSetFromStoredProcedure(cmdLoadAssetToGrid) dgAssetLocator.DataSource = dsLoadAssetToGrid.Tables(0).DefaultView dgAssetLocator.TableDescriptor.ResetColumns() .......... ............ ............... Regards, Calvin.

Loader.
Live Chat Icon For mobile
Up arrow icon