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

GGC table and nested table sizing

Thread ID:





39471 Jan 9,2006 07:18 PM UTC Jan 12,2006 10:04 AM UTC WinForms 1
Tags: GridControl
Mike Monk
Asked On January 9, 2006 07:18 PM UTC

Hello, How would I automatically size the grid to the client width? I have found some code in the forum but it doesn''t handle the top level table properly nor does it handle the nested tables. The forum sample I''m referring to is http://www.syncfusion.com/Support/forums/message.aspx?MessageID=34801 Ultimately, I would like the nested tables to size to the client area which should line up exactly with the parent table. Regards, Mike

stanleyj [Syncfusion]
Replied On January 12, 2006 10:04 AM UTC

Hi Mike, This code will work for nested tables also. this.gridGroupingControl1.GetTableModel("GrandChildTable").QueryColWidth += new GridRowColSizeEventHandler(TableModel_QueryColWidth); this.gridGroupingControl1.GetTableModel("ChildTable").QueryColWidth += new GridRowColSizeEventHandler(TableModel_QueryColWidth); this.gridGroupingControl1.TableModel.QueryColWidth += new GridRowColSizeEventHandler(TableModel_QueryColWidth); int indentCols; int ParentIndentColsCount; int ChildIndentColsCount; private void TableModel_QueryColWidth(object sender, GridRowColSizeEventArgs e) { GridTableModel gridModel = sender as GridTableModel; GridTableControl grid = (GridTableControl) gridModel.ActiveGridView; if (gridModel != null && grid != null) { int availableArea; indentCols = gridModel.GetColumnIndentCount() * gridGroupingControl1.TableOptions.IndentWidth; if(grid.TableDescriptor.Name == "GrandChildTable") { if(e.Index > gridModel.Cols.HeaderCount + gridModel.GetColumnIndentCount()-1) { availableArea = gridGroupingControl1.ClientSize.Width - gridModel.ColWidths.GetTotal(0, gridModel.Cols.HeaderCount)- indentCols - ParentIndentColsCount* gridGroupingControl1.TableOptions.IndentWidth - ChildIndentColsCount* gridGroupingControl1.TableOptions.IndentWidth; e.Size = (int)availableArea / (gridModel.ColCount-gridModel.GetColumnIndentCount()-1); e.Handled = true; } } else if(grid.TableDescriptor.Name == "ChildTable") { int startQueryFrom = gridModel.Cols.HeaderCount + gridModel.GetColumnIndentCount()-1; if(e.Index > startQueryFrom) { ChildIndentColsCount = gridModel.GetColumnIndentCount(); availableArea = gridGroupingControl1.ClientSize.Width - gridModel.ColWidths.GetTotal(0,gridModel.Cols.HeaderCount) - indentCols - ParentIndentColsCount* gridGroupingControl1.TableOptions.IndentWidth; e.Size = (int)availableArea / (gridModel.ColCount-gridModel.GetColumnIndentCount()); e.Handled = true; } } else { if(e.Index > gridModel.Cols.HeaderCount + gridModel.GetColumnIndentCount()-1) { ParentIndentColsCount = gridModel.GetColumnIndentCount(); availableArea = gridGroupingControl1.ClientSize.Width - SystemInformation.VerticalScrollBarWidth - indentCols; e.Size = (int)availableArea / (gridModel.ColCount-gridModel.GetColumnIndentCount()); e.Handled = true; } } } } Best regards, Stanley


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