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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to make grid columns use 100% grid width

Thread ID:





88334 Jul 20,2009 07:00 AM UTC Jul 21,2009 03:23 PM UTC WinForms 1
Tags: GridControl
Tomasz Wasala
Asked On July 20, 2009 07:00 AM UTC


I have following problem. I created a form with GridDataboundGrid. When forms loads I fill grid from database dynamically.

The problem is that I dont know how to make grid use 100% width (stretch columns).
As you can see on screenshot the grid takes about 50% of width.
How can I make it use 100% width by default (even when there are more columns)?

Thanks for answer,
Tomasz Wąsala


Rajadurai C [Syncfusion]
Replied On July 21, 2009 03:23 PM UTC

Hi Tomasz,

Thanks for your interest in Syncfusion Products.

There is no special property setting for this. However it can be achieved through the QueryColWidth event handler.

The following code achieves this feature.

void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e)
if (e.Index == this.gridDataBoundGrid1 .Model.ColCount)
int i = e.Index - 1;
int width = this.gridDataBoundGrid1.ClientSize.Width - this.gridDataBoundGrid1.Model.ColWidths[0];
while (i > 0 && width - this.gridDataBoundGrid1 .Model.ColWidths[i] > 0)
width -= this.gridDataBoundGrid1 .Model .ColWidths[i];
e.Size = width;
e.Handled = true;

You can handle this event through the following code in Form_Load event.

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



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