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

Grid to Extend entire Area

Thread ID:





58662 Mar 26,2007 11:55 AM Mar 26,2007 02:58 PM Windows Forms 1
Tags: GridControl
Asked On March 26, 2007 11:55 AM

Hi All,

Is there any way to make the DataGrid "FILL"
the entire page even when the grid s smaller than
the area it occupies ? Even if I dock the control as a "Fill" there is unused space if the
data is not enough to fill the grid. Can I auto
expand the length and width so the GRID takes
up all usuable space.


Rajagopal [Syncfusion]
Replied On March 26, 2007 02:58 PM

Hi Rick,

You can resize the columns and rows to fit over the grid's entire area, by handling the Grid.Model.QueryColWidth and Grid.Model.QueryRowHeight respectively. Below are the code snippets that helps in doing this.

private void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e)
if(e.Index > this.gridDataBoundGrid1.Model.Cols.HeaderCount)
int clientwidth = this.gridDataBoundGrid1.ClientRectangle.Width - this.gridDataBoundGrid1.Model.ColWidths[0];
e.Size = (int)(clientwidth / (float)this.gridDataBoundGrid1.Model.ColCount);
e.Handled = true;

private void Model_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
if(e.Index > this.gridDataBoundGrid1.Model.Cols.HeaderCount)
int clientheight = this.gridDataBoundGrid1.ClientRectangle.Height - this.gridDataBoundGrid1.Model.RowHeights[0];
e.Size = (int) ( clientheight / (float) this.gridDataBoundGrid1.Model.RowCount );
e.Handled = true;



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.

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.