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

Merge identical cells in a DataBoundGrid

Hi,

I'm trying to show hierarchical data in a multi-record style, rather than the expanded tree style.
-----------------------------------
parent1 || son1 specific details
master || ----------------------
details || son2 specific details
-----------------------------------
parent2 || son1 specific details
master || ----------------------
details || son2 specific details
-----------------------------------

I have hierarchical data I represent as a single dataSource, where I'm using a view that contains for each record all the Master details and the specific details.
The data is sorted by the master's columns,
and in this way all the details under the same master are visually grouped.

Instead of having the Master's values repeated in each record group, I want it to Merge all the identical cells.

How can it be done through the code without having to go through the records one by one and asking if the cell's value matches the value of the cell above?

Thanks,
- Miriam.


6 Replies

NA Nisha Arockiya A Syncfusion Team December 18, 2008 10:36 AM UTC

Hi Miriam,

Thanks for your interest in Syncfusion Products.

I have prepared a sample of multi-row record GDBG (each record consumes 9 rows in the grid).
Please refer to it in the sample location.
http://websamples.syncfusion.com//samples/Grid.Windows/Development/GridMultiRowRecord_F78546.zip

Please let me know any further assistance.

Regards,
Nisha



NA Nisha Arockiya A Syncfusion Team December 18, 2008 10:42 AM UTC

Hi again Miriam,

You can also refer to our shipped browser sample in the following path.

..\\My Documents\Syncfusion\EssentialStudio\6.x.x.x\Windows\Grid.Windows\Samples\x.x[FrameWork]\DataBound\MultiRowRecord

Please let me know if this helps.

Regards,
Nisha



AD Administrator Syncfusion Team December 18, 2008 03:10 PM UTC

Hi Nisha,

Thanks for your reply, but this is not what I asked for.
I am not looking to show the same record on different lines.

assuming we have one table with 5 columns :
1.Family_name, 2.Father_name, 3.Mother_Name, 4.Child_Name, 5. Child_Age

If I sort the table by column's 1,2,3 I will get all the children under the same family grouped visually.
Columns 1,2,3 are the same for all the children in the same family. [See attached Sample 1].
I would like the results to bind to the grid without repeating the family's info.[See attached Sample 2].

I don't want to add hierarchy to the table, because then I would get a tree view that takes too much horizontal space. [See attached Sample 3].

Can you please help me out?
thanks in advance,
- Miriam.



GridHelpSamples_2487193.zip


NA Nisha Arockiya A Syncfusion Team December 19, 2008 12:11 PM UTC

Hi Miriam,

Thanks for the updates.

You can refer to a browser sample that will give you an idea on implementing multi-row-record.

..\\My Documents\Syncfusion\EssentialStudio\6.x.x.x\Windows\Grid.Grouping.Windows\Samples\3.5\FeaturedSamples\EmployeeView\cs

Please try and let me know if this helps.

Regards,
Nisha



AD Administrator Syncfusion Team December 22, 2008 11:27 AM UTC

Hi Nisha,

Once again, I'm NOT looking for implementing multi-row-record.

I am looking to implement a parent-children record.
Please take a deeper look at the sample I sent you in the previous message I posted.

I want to show for each parent record a few child records, but I don't want it to look like a list of the parent records that each record expands to show the children.
I want the first columns to show the parent details, and then in the next columns show the children, exactly as I described in the attachment I've sent you previously.

Please help!
Thanks,
- Miriam.



NA Nisha Arockiya A Syncfusion Team December 24, 2008 12:06 PM UTC

Hi Miriam,

Thanks for your updates.

To sort the merged cells correctly, you have to handle QueryCoveredRange event. Please refer to the following code snippet.

void TableModel_QueryCoveredRange(object sender, GridQueryCoveredRangeEventArgs e)
{
Element element = this.gridGroupingControl1.TableModel.GetDisplayElementAt(e.RowIndex);

if (element != null && element.Kind == DisplayElementKind.Record && e.ColIndex == 2)
{
Record rec = element.GetRecord();
if (rec.GetSourceIndex() == 0)
{
e.Range = GridRangeInfo.Cells(e.RowIndex, e.ColIndex, e.RowIndex + 3, e.ColIndex);
e.Handled = true;
}
}
}

The attached sample demonstrates this completely.
http://websamples.syncfusion.com//samples/Grid.Windows/Development/GGC_Merge_78546.zip

Please let me know any further assiatance.

Regards,
Nisha


Loader.
Live Chat Icon For mobile
Up arrow icon