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.
Syncfusion Feedback

Grid with multi-level header

Thread ID:

Created:

Updated:

Platform:

Replies:

77861 Nov 19,2008 12:36 PM UTC Nov 26,2008 04:29 PM UTC Windows Forms 4
loading
Tags: GridControl
Daniel Santos de Carvalho
Asked On November 19, 2008 12:36 PM UTC

Hi everyone,

I would like a help with a grid i'm trying to implement.

I'm trying to create a grid with three columns, one for month, one for quantity and other for percentage of a product. The rows will describe the months, the quantity and percentage of each month. But i wanted to place a header, with a row with the description of the column and a upper row header with the name of the product with "merged" cell that would take the space of all the columns.

How can i make a line with more than one row? And how can i merge the descriptions of a header?


Jisha Joy [Syncfusion]
Replied On November 20, 2008 05:25 AM UTC


Hi Daniel,

We appreciate your interest in Syncfusion Products.

Additional row headers can be added below the existing header by setting the Model.Rows.HeaderCount. Model.Rows.FrozenCount is set so that the additional headers don’t scroll.

int extraRowHeaders = 2;
int extraColHeaders = 1;
this.gridDataBoundGrid1.Model.Rows.HeaderCount = extraRowHeaders; this.gridDataBoundGrid1.Model.Rows.FrozenCount = extraRowHeaders;
this.gridDataBoundGrid1.Model.Cols.HeaderCount = extraColHeaders;
this.gridDataBoundGrid1.Model.Cols.FrozenCount = extraColHeaders;

The Model.CoveredRanges is used to cover some cells and to show them as a group.

this.gridDataBoundGrid1.Model.CoveredRanges.Add(GridRangeInfo.Cells(1, 2, 1, 3));
this.gridDataBoundGrid1[1, 2].Text = "Covered Cell - Group One";


Please refer the following browser sample for more details:
..\\My Documents\Syncfusion\EssentialStudio\{version}\Windows\Grid.Windows\Samples\2.0\DataBound\GDBGMultiHeader



This sample will show you how to have multiple row and / or column headers in your GridDataBoundGrid as well as additional unbound rows or columns.

Please try this and let me know if this helps.

Regards,
Jisha


Daniel Santos de Carvalho
Replied On November 25, 2008 05:57 PM UTC

Hi Jisha,

Actually, i'm trying to make a 4 rows header, and used the code below from based on the example...

int extraRowHeaders = 3;
int extraColHeaders = 1;
this.gridDataBoundGrid1.Model.Rows.HeaderCount = extraRowHeaders;
this.gridDataBoundGrid1.Model.Rows.FrozenCount = extraRowHeaders;
this.gridDataBoundGrid1.Model.Cols.HeaderCount = extraColHeaders;
this.gridDataBoundGrid1.Model.Cols.FrozenCount = extraColHeaders;

I wrote the code as the example and worked fine for two rows header, but i have difficult accessing "text property" of cells of the header with more rows (like "rowindex" 2 and 3):

this.gridDataBoundGrid1[2, 2].Text = "Covered Cell";
this.gridDataBoundGrid1[3, 2].Text = "Covered Cell";

The code above give indexoutofbounds exception..


Jisha Joy [Syncfusion]
Replied On November 26, 2008 09:57 AM UTC

Hi Daniel,

Please try to handle QueryCellInfo event and set the text there by checking Rowindex and ColumnIndex. Please see the code:


this.gridDataBoundGrid1.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo);




void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if (e.RowIndex == 2 && e.ColIndex == 2)
e.Style.Text = "Covered Cell ";
}

Regards,
Jisha


Daniel Santos de Carvalho
Replied On November 26, 2008 04:29 PM UTC

Ok, it worked perfectly

Thanks a lot, Jisha!


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.

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

;