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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Thread ID:





10464 Feb 3,2004 11:34 AM UTC Feb 4,2004 02:07 PM UTC WinForms 5
Tags: GridControl
Emil Damian
Asked On February 3, 2004 11:34 AM UTC

Why cannot change the width of a column at design time?

Administrator [Syncfusion]
Replied On February 3, 2004 01:03 PM UTC

You can for a GridControl, but cannot for a GridDataBoundGrid. The GridBoundColumns which you have access to at design time for a GridDataBoundGrid, do not have a Width property associated with them. You can derive GridBoundColumn and add a Width property to it. Here is a sample that adds such a property, the CustomGridBoundColumn.Width, that can be used both design time and runtime as long as it is not zero. It has a Northwind datasource set in the designer, so you may have to tweak that to get it to run on your system. It does so by listening to the Model.QueryColWidths event, and if there is a non zero width value in a column, it provides it in this event. Subscribing to the event is a little problematic in that you cannot do it in the grid''s constructor as the Model is not fully functional at that point. So, this sample uses an OnPaint override to subcribe with a flag set to to repeatedly subscribing. There may be a better place to put this, but this seems to work.

Marco Ensing
Replied On February 4, 2004 01:23 AM UTC

Clay, Thanks for the example. Is this going to be part of the 2.* release ? What would be really nice if the column width would persist state. Something similar as the docking control. I tried to set the QueryColWidth() but then the user can not re-size the columns later on. Or the values will not be restored the next time. Marco

Administrator [Syncfusion]
Replied On February 4, 2004 06:30 AM UTC

In the 2.0 GridGroupingControl, you can persist look and feel elements like column width, but the GridBoundColumn used by the GridDataBoundGrid has not been changed yet to include a width property. There are samples in this forum thread that show how you can persist your user''s column order and size at runtime. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=3918

Marco Ensing
Replied On February 4, 2004 12:32 PM UTC

Tnaks for your reply. Problem with the GridGroupControl is that it is too slow. Originally I made an example with the GridGroupControl, and now I''m changing it to the GridControl. (I know I loose some features) I also ran the syncfusion GripGrouping examples and when I want to switch from the first record to the last record, it takes too long. The gridDataBoundGrid seems to be much more responsive to user interactions. If I''m not mistaken the GridGroupControl is a further specialization of the GridControl. Wonder what other peoples perception is on this issue. Marco

Administrator [Syncfusion]
Replied On February 4, 2004 02:07 PM UTC

The current emphasis for the GridGroupingControl has been the feature set. We have yet to try to optimize it for performance, but that is coming.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon