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.

GridListControl column heading text

Thread ID:





16879 Jul 26,2004 04:32 PM Jul 27,2004 10:53 AM Windows Forms 3
Tags: GridControl
Bill Sass
Asked On July 26, 2004 04:32 PM

I have a GridListControl that I am unable to make column heading names with text than includes spaces.

Administrator [Syncfusion]
Replied On July 26, 2004 05:23 PM

If the DataSource is a DataTable, and you change the DataColumn.ColumnName to the text with the space, then I see the column header with the space. If you are using an ArrayList for the DataSource, then you will need to use the grid''s PrepareViewStyleInfo event to see the column header. GridListControl started its life as an internal control for use as the list for a multicolumn combobox within the grid itself. Because of this, it currently does not have all the customization hooks that you would normally see in a control. At some point in the future, we plan to revisit this control to provide better customization options. Until that point, working with the internal grid is really the only way to try to customize it. Here is a little sample.

Bill Sass
Replied On July 27, 2004 10:15 AM

The Grid list control is actually the cell type as in: this.gridControl1[2, 2].CellType = "GridListControl"; >I have a GridListControl that I am unable to make column heading names with text than includes spaces.

Administrator [Syncfusion]
Replied On July 27, 2004 10:53 AM

You do it the same way by getting the renderer for the GridListControl cell. From there, you can get renderer.ListBoxPart which is teh GridListControl, and from there you get the Grid member. The problem is that Dropdown list can vary from cell to cell which means that potentially you have to change teh headers for every cell. It would be simplest to just use a DataTable as your DataSource and to set the ColumnName to what you want to see. If you cannot do this for some reason, then you would want to catch CurrentCellShowingDropDown and if the cell being dropped is a GridListControl cell for which you want to modify the headers, then you could subscribe to the cellRenderer.ListControlPart.Grid.PrepareViewStyleInfo event as in the sample. Then in CurrentCellDropDownCLosed, you would weant to unsubscribe to the event. Here is code you might use to subscribe to the event.
private void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.ColIndex == 1 && cc.RowIndex == 3) // the cell you want
		GridDropDownGridListControlCellRenderer cr = this.gridControl1.CurrentCell.Renderer as GridDropDownGridListControlCellRenderer;
			if(cr != null)
			GridDropDownGridListControlPart list = (GridDropDownGridListControlPart)cr.ListControlPart;
			list.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PVSI);


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.