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.

How to Merge Columns in Grid Grouping control

Thread ID:

Created:

Updated:

Platform:

Replies:

68023 Sep 6,2007 12:25 PM May 18,2010 12:19 AM Windows Forms 4
loading
Tags: GridControl
Venkat Akella
Asked On September 6, 2007 12:25 PM

Hi,

I have to merge multiple columns and display a single header text for the merged columns in grid grouping control. Is it possible???.
Can you guys suggest an approach.

Rajagopal [Syncfusion]
Replied On September 6, 2007 01:36 PM

Hi Venkat,

Thanks for your interest in Syncfusion Products.

You can merge columns in grid and make it behave like a cell single cell with a headertext by handling the TableModel.QueryCoveredRange event of the GridGroupingControl. Below is the code snippet.

void TableModel_QueryCoveredRange(object sender, GridQueryCoveredRangeEventArgs e)
{
Element el = this.gridGroupingControl1.TableModel.GetDisplayElementAt(e.RowIndex);
if (el != null && el.Kind == DisplayElementKind.ColumnHeader)
{
int lastCol = this.gridGroupingControl1.TableDescriptor.VisibleColumns.Count;
e.Range = GridRangeInfo.Cells(e.RowIndex, 1, e.RowIndex, lastCol);
e.Handled = true;
}
}

Here is a sample demonstrating this
http://websamples.syncfusion.com/samples/Grid.Windows/F68023/main.htm

Let me know if you have any other questions.

Regards,
Rajagopal

Venkat Akella
Replied On September 10, 2007 10:07 AM



>Hi Venkat,

Thanks for your interest in Syncfusion Products.

You can merge columns in grid and make it behave like a cell single cell with a headertext by handling the TableModel.QueryCoveredRange event of the GridGroupingControl. Below is the code snippet.

void TableModel_QueryCoveredRange(object sender, GridQueryCoveredRangeEventArgs e)
{
Element el = this.gridGroupingControl1.TableModel.GetDisplayElementAt(e.RowIndex);
if (el != null && el.Kind == DisplayElementKind.ColumnHeader)
{
int lastCol = this.gridGroupingControl1.TableDescriptor.VisibleColumns.Count;
e.Range = GridRangeInfo.Cells(e.RowIndex, 1, e.RowIndex, lastCol);
e.Handled = true;
}
}

Here is a sample demonstrating this
http://websamples.syncfusion.com/samples/Grid.Windows/F68023/main.htm

Let me know if you have any other questions.

Regards,
Rajagopal


thank you, if i want to merge from the middle columnsheaders of the grid then?

Rajagopal [Syncfusion]
Replied On September 10, 2007 02:31 PM

Hi Venkat,

In the TableModel.QueryCoveredRange event of the GridGroupingControl, you need to specify the range of the cells that you want it merged/covered. To cover the column headers from any column index in the middle, then you need to pass the column index from which the cells should be covered and the column index untill which the columns will be covered. Please refer the below sample that shows the column headers being covered from middle.

http://websamples.syncfusion.com/samples/Grid.Windows/F68023/main.htm

Let me know if you have any other questions.

Regards,
Rajagopal

canh nguyen
Replied On May 18, 2010 12:19 AM

How to merge cell in gridGroupingControl?,please help me.

Thank you very much.

CONFIRMATION

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.

;