How do I enlarge the width of a grid bound column

Hello, I do have a GridDataBoundGrid and inside the grid I do have couple of GridBoundColumn(s) and their StyleInfo-CellType is set to GridListControl (I display for example BranchID, BranchName). How do I set the width of this grid to a certain size ? Thank you !

2 Replies

SA Steli Andrei December 22, 2003 03:01 PM UTC

To be more clearer: How do I set the width of this grid that shows up in the GridBoundColumn ? It is too short and I have to use the scroll bars to navigate in the grid. >Hello, I do have a GridDataBoundGrid and inside the grid I do have couple of GridBoundColumn(s) and their StyleInfo-CellType is set to GridListControl (I display for example BranchID, BranchName). How do I set the width of this grid to a certain size ? Thank you !


AD Administrator Syncfusion Team December 22, 2003 04:26 PM UTC

I am not sure whether you want to change the width of the column, or the width of the Drowpdown. To change the width of a column in a GridDataBoundGrid, you do two things: this.grid.AllowResizeToFit = false; this.grid.Model.ColWidths[colIndex] = 300; If you want to change the width of the DropDown in a GridListControl CellType, then you have to handle the CurrentCellShowingDropDown event, and set e.Size there. (Only the width is applicable in a GridListControl celltype, the height is determined by the DropDownRows parameter.
private void grid_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
	GridCurrentCell cc = this.grid.CurrentCell;
	if(cc.ColIndex == 5 ) //dropdown column
	{
		GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer;
		if(cr != null)
		{
		//change teh height
	((GridDropDownGridListControlPart)cr.ListControlPart).DropDownRows = 10;
			//change the width
			e.Size = new Size(400, e.Size.Height); 
		}
	}
}

Loader.
Up arrow icon