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

GridListControl column heading text

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

3 Replies

AD Administrator Syncfusion Team July 26, 2004 09:23 PM UTC

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.

BS Bill Sass July 27, 2004 02:15 PM UTC

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.

AD Administrator Syncfusion Team July 27, 2004 02:53 PM UTC

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

Live Chat Icon For mobile
Up arrow icon