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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridGroupingControl column layout

Thread ID:





37012 Nov 14,2005 10:04 PM UTC Nov 16,2005 03:38 PM UTC WinForms 8
Tags: GridControl
Administrator [Syncfusion]
Asked On November 14, 2005 10:04 PM UTC

Is there anyway to control the column layout of an individual row. I am using column spanning to display my row of data in a two line display. However I need to change the layout of individual rows based on the data in that row. As an alternative which might be easier is it possible to supress the display of one of the lines based on a value.

Administrator [Syncfusion]
Replied On November 14, 2005 11:06 PM UTC

If you want to hide a row, you can handle the grid.Mode.QueryRowHeight event. There if e.Index points to the row you do not want to see, you can set e.Size = 0 and e.handled = true. I do not know of a simple way to scramble columns on a row by row basis in a GriDataBoundGrid. You could try using grid.model.QueryCellInfo event to try to do this, but it might get tricky real quick.

Administrator [Syncfusion]
Replied On November 14, 2005 11:16 PM UTC

How would I know if the row is the first or second of the record? I only want to supress the display of the second line in the multiline record.

Administrator [Syncfusion]
Replied On November 14, 2005 11:23 PM UTC

You can get the GridBoundRecordState for the row using grid.Binder.GetRecordStateAtRowIndex. The you can check the GridBoundRecordState.RowIndexInRecord property to see what row in the record you are on. Or, if you have 2 rows per record, you could just check if the row index is even or odd.

Administrator [Syncfusion]
Replied On November 15, 2005 06:53 PM UTC

I don''t see how you get the GetRecordStateAtRowIndex from the query row height method in a grid grouping control?

Administrator [Syncfusion]
Replied On November 15, 2005 07:06 PM UTC

The discussion we were having only applies to a GridDataBoundGrid. QueryRowHeight will not do anything in a GridGroupingControl. To programmatically set row heights in a GridGroupingControl, you have to use a custom engine as in the \Windows\Grid.Windows\Samples\Grouping\ResizableRows sample. But I do not know if this will serve you r needs or not. If you need to dynamically decide what should appear in a particular cell, then I think you should try using QueryCellStyleInfo.

Administrator [Syncfusion]
Replied On November 15, 2005 07:22 PM UTC

Sorry the subject was gridgroupingcontrol. The rowquery event was working except I have a group summary row that messes up the index to allow alternating rows to work. I looked at the ResizableRows sample and I don''t think it will help much.

Administrator [Syncfusion]
Replied On November 16, 2005 03:16 PM UTC

I am still stuck on this. Is there anyway based on the row number to determine which line of the two line display I am using that I am on. Based on which columns are displayed for that row or getting a cell value or anything?

Administrator [Syncfusion]
Replied On November 16, 2005 03:38 PM UTC

You can use the TableDescriptor.ColumnToRowColIndex to get this information. Here is code you can add to a TableControlDrawCellDisplayText event handler in the \\Windows\Grid.Windows\Samples\Grouping\EmployeeView sample that shows you you can use it. You need the column name which you can get from the e.Style in QueryCellStyleInfo in a similar manner as shown below.
private void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)
	GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
	if(style.TableCellIdentity.Column != null)
		int row, col;
		if(style.TableCellIdentity.Table.TableDescriptor.ColumnToRowColIndex(style.TableCellIdentity.Column.Name, out row, out col))
			e.Inner.DisplayText = string.Format("{0}_{1}_{2}", row, col, e.Inner.DisplayText);


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon