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.

ResizeToFit and nested tables

Thread ID:

Created:

Updated:

Platform:

Replies:

34123 Sep 2,2005 05:47 AM Sep 2,2005 10:29 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 2, 2005 05:47 AM

I have a gridgroupingcontrol which is bound to a dataset (which contains two tables). How can i autosize all columns for both tables (also cells of cell type combobox). Any ideas?

Administrator [Syncfusion]
Replied On September 2, 2005 10:29 AM

The only way I know would be to call TableControl.Model.ColWidths.ResizeToFit on each of the tables. Here is a button handler that does this for a 3 tables releated tables, parent, child and grandchild.
private void button1_Click(object sender, System.EventArgs e)
{
	this.gridGroupingControl1.BeginUpdate();
	GridTableDescriptor parentTD = this.gridGroupingControl1.TableDescriptor;
	GridTableControl tc  = this.gridGroupingControl1.GetTableControl(parentTD.Name);
	tc.Model.ColWidths.ResizeToFit(GridRangeInfo.Table());
	
	GridTableDescriptor childTD = parentTD.Relations["ParentToChild"].ChildTableDescriptor;
	tc  = this.gridGroupingControl1.GetTableControl(childTD.Name);
	tc.Model.ColWidths.ResizeToFit(GridRangeInfo.Table());

	GridTableDescriptor gridChildTD = childTD.Relations["ChildToGrandChild"].ChildTableDescriptor;
	tc  = this.gridGroupingControl1.GetTableControl(gridChildTD.Name);
	tc.Model.ColWidths.ResizeToFit(GridRangeInfo.Table());
	this.gridGroupingControl1.EndUpdate(true);
}

CONFIRMATION

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.

;