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

How to automatically adjust the column width based on the contents, using GridGroupingControl ?

Hi,

How to automatically adjust the column width based on the contents, using GridGroupingControl ?

It can be done in Visual Studio's DataGridView by setting the attribute AutoSizeColumnMode to DisplayedCells,
Is there a similar way in GridGroupingControl?

thanks :)

3 Replies

AG Anish George Syncfusion Team May 17, 2016 06:56 AM UTC

Hi TrySyncfusion, 
 
Thank you for using Syncfusion products. 
  
Please try using the ColWidths.ResizeToFit method to achieve the auto size behavior in GridGroupingControl. Refer the below code snippet. 

C#: 
// Resize the width of the 2nd column according to the contents in it. 
this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(GridRangeInfo.Col(2), GridResizeToFitOptions.IncludeHeaders); 



Please let us know is you need any further assistance. 

Regards, 
Anish. 



TR TrySyncfusion May 18, 2016 02:48 AM UTC

It works, thanks a lot. ^_^  


AG Anish George Syncfusion Team May 18, 2016 11:41 AM UTC

Hi TrySyncfusion, 
  
We are glad to hear that the given suggestion meets your requirement. 
  
Please let us know if you need any further assistance. 
  
Regards,
Anish 


Loader.
Live Chat Icon For mobile
Up arrow icon