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

How to set the width of a column

This should have been really easy to do, or at least easy to find in your examples/demos/forums, but here I am asking it.

How can I set the width of a column?

I went to the GridColumnDescriptor Collection Editor, changed the widths of my columns, but they keep resizing based on the contents of the fields.

I also tried a whole bunch of other stuff in the design and via code to no avail.

3 Replies

RP Rekha P Syncfusion Team June 26, 2009 01:03 PM UTC

Hi Manuel,

Thank you for your interest in Syncfusion Products.

The column with can be set using the Width property referred from the GridColumnDescriptor collections. Refer any one of the way to set the Width for the Grid columns.

[ASPX]








[C#]
//To set the width uniformly for all the columns.
foreach (GridColumnDescriptor gcd in this.GridGroupingControl1.TableDescriptor.Columns)
{
gcd.Width = 90;
}

//To set it for individual columns.
this.GridGroupingControl1.TableDescriptor.Columns[0].Width = 50;
this.GridGroupingControl1.TableDescriptor.Columns[1].Width = 50;


Please let me know if these snippets helps you out.

Thanks,
Rekha


PF Peter Fithian October 27, 2010 05:56 PM UTC

In case anyone, like me, reads this and thinks it will work - it doesn't.



BM Bharath M Syncfusion Team November 2, 2010 05:09 AM UTC

Hi Peter,

We regret for the inconvenience caused.

We have tested the solution provided and it is working fine. Could you please update us a simple sample to reproduce this issue, so that we could sort out the cause of the issue and provide you a solution.

Let me know if you have any concerns.

Regards,
Bharath


Loader.
Live Chat Icon For mobile
Up arrow icon