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
close icon

ResizeToFit and nested tables

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?

1 Reply

AD Administrator Syncfusion Team September 2, 2005 02:29 PM UTC

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);
}

Loader.
Live Chat Icon For mobile
Up arrow icon