This is a migrated thread and some comments may be shown as answers.

Merge Cells

1 Answer 119 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nils Beckmann
Top achievements
Rank 1
Nils Beckmann asked on 20 Sep 2009, 08:37 PM
Hey Telerik team and users!

Its been a while since someone asked for some help related to cells and merging them.
So here I am.
What I'm trying to do is to merge specific cells, I need rowspan and colspan.

I'd love something like: DataGrid.Rows[0].Cells[2].Colspan(2);
Which merges Cells 3,4 and 5 in the first row (zero-based index for the cells) . Looking for something similar to use rowspan ;)

Is that possible that way or the other? I'm quite desperate by now. So there's HtmlView but I'm not quite sure if this does the trick for me. And it seemed to me a bit complicated, to be honest.

I'd be glad for some help and suggestions!
best regards!

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 23 Sep 2009, 11:53 AM
Hello Nils Beckmann,

You are correct, this is not a common question. Currently we support cell merge only in HTML view. It specifies the layout of a single row. So, when you merge a cell in this view, the cell will be merged for every row in grid.

You should set the ColSpan property of the desired column:

HtmlViewDefinition view = new HtmlViewDefinition(); 
//... 
view.RowTemplate.Rows[0].Cells[2].ColSpan = 2; 
//... 
this.radGridView1.ViewDefinition = view; 

Please look at the following blog article for a simple tutorial about HtmlViewDefinition. I will log your suggestion as a feature request in our TODO and we will consider adding cell merge for specific cell in a future version.

If you need further assistance I will be glad to help.

All the best,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Nils Beckmann
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or