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

GridGroupingControl column layout

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.

8 Replies

AD Administrator Syncfusion Team 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.


AD Administrator Syncfusion Team 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.


AD Administrator Syncfusion Team 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.


AD Administrator Syncfusion Team 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?


AD Administrator Syncfusion Team 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.


AD Administrator Syncfusion Team 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.


AD Administrator Syncfusion Team 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?


AD Administrator Syncfusion Team 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 \3.3.0.0\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);
		}
	}
	
}

Loader.
Live Chat Icon For mobile
Up arrow icon