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

multiple header

I just downloaded the trial of Essential Grid today. I had been struggle to get the grid to display multiple headers.

...

//MatrixTableAdapter implements IBinindList
grid.DataSource = MatrixTableAdapter();
grid.Model.Rows.HeaderCount = 1;
grid.Model.Rows.FrozenCount = 1;

...

The data displays fine, but it just doesn''t want to display the extra header row.

Any help is greatly appreciated so I may continue my evaluation of the product.

Thanks,

Nathan


11 Replies

AD Administrator Syncfusion Team September 2, 2006 10:39 PM UTC

Your code seems OK. Here is a sample showing it working.

http://www.syncfusion.com/Support/user/uploads/GridDataBoundGrid_SelectCell_7053c38a.zip

Are you seeing any exceptions being thrown? Can you post a sample showing what you are doing and we can try to debug it here?


AD Administrator Syncfusion Team September 5, 2006 06:12 PM UTC

Here is the exact code that I''m work with.

[Test]
public void SyncfusionBinding()
{
int start = 1;
GridDataBoundGrid grid = new GridDataBoundGrid();
grid.DataSource = new MatrixTableAdapter(m);
grid.Model.Rows.HeaderCount = 1; grid.Model.Rows.FrozenCount = 1;
foreach (MatrixColumnGroup group in m.Groups)
{
int span = start + group.ColumnCount - 1;grid.Model.CoveredRanges.Add(GridRangeInfo.Cells(1, start, 1, span));
grid[1, start].Text = group.Name;
start = span + 1;
}

grid.Dock = DockStyle.Fill;
Form f = new Form();
f.Text = "SyncfusionBindingTest";
f.Controls.Add(grid);

Application.Run(f);
}


NA nathan September 5, 2006 06:15 PM UTC

Here is the exact code that I''m working with.
public void SyncfusionBinding()
{
int start = 1;
GridDataBoundGrid grid = new GridDataBoundGrid();
grid.DataSource = new MatrixTableAdapter(m);
grid.Model.Rows.HeaderCount = 1;
grid.Model.Rows.FrozenCount = 1;
foreach (MatrixColumnGroup group in m.Groups)
{
int span = start + group.ColumnCount - 1;
grid.Model.CoveredRanges.Add(GridRangeInfo.Cells(1, start, 1, span));
grid[1, start].Text = group.Name;
start = span + 1;
}

grid.Dock = DockStyle.Fill;
Form f = new Form();
f.Text = "SyncfusionBindingTest";
f.Controls.Add(grid);

Application.Run(f);
}

Also, I''m curious if it possible to group the column headers above the actual column header row, or if you can only have the grouping on the row below.

Thank for the help!

Nathan


AD Administrator Syncfusion Team September 6, 2006 09:25 AM UTC

Hi Nathan,

Currently this feature is not supported in GridDataBoundGrid. But you can group the rows using the GroupingGrid. See the browser samples in Grid.Grouping category for more details.

Here is a link.
[Instal drive] \Syncfusion\Essential Studio\4.3.0.0\windows\Grid.Grouping.Windows\Samples\GridGroupingTutorial
[Instal drive]\Syncfusion\Essential Studio\4.3.0.0\windows\Grid.Grouping.Windows\Samples\GroupCustomers

Thanks,
Haneef


NA nathan September 6, 2006 02:05 PM UTC

Thanks for the response. I''ve looked at the GroupingGrid, and that isn''t what we are looking for. We''re simply looking to be able to add a second row of column headers. So far in my sandbox with GridDataBoundGrid I''m not able to do so... Although, everything I''ve read and seen makes look like you just set a couple of properties.

grid.Model.Rows.HeaderCount = 1; grid.Model.Rows.FrozenCount = 1;

This doesn''t seem to work in my case... See above code snippet from previous post. Keep in mind that MatrixTableAdapter simple implements IBindingList.

In addition to getting being able to add a second row of column headers I would like to know if it then possible to "move" that row to be on top rather than the bottom of the two header rows.

Thanks,
Nathan


CW Chuck W. September 6, 2006 03:04 PM UTC

Haneef,

I''m Nathan''s project lead, and I want to clarify the problem we''re experiencing. You said:

>Currently this feature is not supported in >GridDataBoundGrid. But you can group the rows >using the GroupingGrid. See the browser samples >in Grid.Grouping category for more details.

There seems to be some confusion. We don''t have multiple rows that can be "grouped". We have single rows, where columns are related into groups.

Our grid contains just one type of object. Let''s say it''s an employee object, where columns are grouped into "Personal Data", "Address", "Payroll", etc. We need to display a header row above the column names representing the group that the column is part of. There are examples of doing this type of operation on the row below the column name, but that doesn''t make a lot of sense for the user.

We don''t want to group the data - we just want to group the columns. In other words, we want two header rows, with our own text spanning cells in row[0]. And we want the current behavior of row[0] to be in row[1].


AD Administrator Syncfusion Team September 7, 2006 01:35 PM UTC

The hard part is moving the functionailty from row0 to row1. One way to do this is to use a custom mouse controller to affect this behavior. Here is a link to a sample that does this through a helper class.

http://www.syncfusion.com/Support/user/uploads/HeaderRowHelper_5b4c3982.zip


AD Administrator Syncfusion Team September 7, 2006 02:01 PM UTC

Here is the sample tweaked to handle a problem (headers scrolling) that we saw after we posted the previous sample.

http://www.syncfusion.com/Support/user/uploads/HeaderRowHelper_a2035eb5.zip


NA nathan September 7, 2006 02:57 PM UTC

This is great! It is exactly what we were hoping that we could accomplish. Thanks for your help. It is much appreciated during our evaluation.

Thanks,

Nathan


NA nathan December 20, 2006 05:32 PM UTC

Clay

I'm using the sample below to implement headers in the GDBG that we're using for our application. I've come across an issue I'm hoping that you can help me figure out. I'm using a header count of 2, so I have one spanned header above muliple column headers. Everything seems to work except when I reset the datasource and reformat with a table that has less columns than the inital datasource. Afert resetting the datasource and reformatting the grid the spanned header looks like it is still trying to span the same distance as the intial datasource.

I've tried the code below and various other techniques, but haven't found the solution...

this.docGrid.DataSource = null;
this.docGrid.DataMember = null;
this.docGrid.Model.ResetVolatileData();
this.docGrid.DataSource = new MatrixAdapter(activeDoc);
this.docGrid.Refresh();

I've attaced a doc with some snap shot of what I'm seeing.

Thanks for any help!

Nathan




>Here is the sample tweaked to handle a problem (headers scrolling) that we saw after we posted the previous sample.

http://www.syncfusion.com/Support/user/uploads/HeaderRowHelper_a2035eb5.zip

GDBGHeaderIssue.zip


AD Administrator Syncfusion Team December 21, 2006 06:16 AM UTC

Hi Nathan,

This issue can be avoided by resetting the underlying datasource between the RowHelper.UnWireGrid() and RowHelper.WireGrid() method. And also you can populate the extra header row data using the RowHelper.PopulateRow mehtod. Here is a code snippet.

this.rowHelper.UnwireGrid();

//You code here.....

this.rowHelper.WireGrid(this.gridDataBoundGrid1,2);
//you must set the covered ranges for the columns in a grid.
this.rowHelper.PopulateRow(0,new string[]{ "ResetDataSource"});

Here is a modified sample.
ModifiedHeaderRowHelper.zip

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon