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

HtmlViewDefinition wrong header layout

1 Answer 31 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Zerka
Top achievements
Rank 1
Zerka asked on 13 Mar 2012, 09:34 AM
Hi,
I have simple grid that contains 7 text columns with names column1, column2, ... column7.
When I apply following code I got layout that is shown in file grid1.png.
HtmlViewDefinition view = new HtmlViewDefinition();
view.RowTemplate.Rows.Add(new RowDefinition());
view.RowTemplate.Rows.Add(new RowDefinition());
view.RowTemplate.Rows.Add(new RowDefinition());
 
CellDefinition cell = new CellDefinition();
//row1
cell.UniqueName = "column1";
cell.RowSpan = 1;
cell.ColSpan = 2;
view.RowTemplate.Rows[0].Cells.Add(cell);
 
cell = new CellDefinition();
cell.UniqueName = "column4";
cell.RowSpan = 3;
cell.ColSpan = 1;
view.RowTemplate.Rows[0].Cells.Add(cell);
 
cell = new CellDefinition();
cell.UniqueName = "column5";
cell.RowSpan = 1;
cell.ColSpan = 1;
view.RowTemplate.Rows[0].Cells.Add(cell);
 
//row2
cell = new CellDefinition();
cell.UniqueName = "column2";
cell.RowSpan = 2;
cell.ColSpan = 1;
view.RowTemplate.Rows[1].Cells.Add(cell);
 
cell = new CellDefinition();
cell.UniqueName = "column3";
cell.RowSpan = 2;
cell.ColSpan = 1;
view.RowTemplate.Rows[1].Cells.Add(cell);
 
cell = new CellDefinition();
cell.UniqueName = "column6";
cell.RowSpan = 1;
cell.ColSpan = 1;
view.RowTemplate.Rows[1].Cells.Add(cell);
 
//row3
cell = new CellDefinition();
cell.UniqueName = "column7";
cell.RowSpan = 1;
cell.ColSpan = 1;
view.RowTemplate.Rows[2].Cells.Add(cell);
 
radGridView1.ViewDefinition = view;

Grid2.png shows what I want to achieve.
I am using 2011.3.11 version of Telerik.
Thanks

1 Answer, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 15 Mar 2012, 10:58 AM
Hi Zerka,

Thank you for writing.

There is an issue that comes up with your particular layout. I have added this issue in our Public Issue Tracking System - PITS. You can track its progress and add your vote/comment for it on the following link - PITS Issue. Until it is resolved, the only work around I can offer you is to swap the places of the last two columns. This way the layout works correctly. Here is what I mean by swapping:
HtmlViewDefinition view = new HtmlViewDefinition();
view.RowTemplate.Rows.Add(new RowDefinition());
view.RowTemplate.Rows.Add(new RowDefinition());
view.RowTemplate.Rows.Add(new RowDefinition());
 
CellDefinition cell = new CellDefinition();
//row1
cell.UniqueName = "column1";
cell.RowSpan = 1;
cell.ColSpan = 2;
view.RowTemplate.Rows[0].Cells.Add(cell);
 
cell = new CellDefinition();
cell.UniqueName = "column5";
cell.RowSpan = 1;
cell.ColSpan = 1;
view.RowTemplate.Rows[0].Cells.Add(cell);
 
cell = new CellDefinition();
cell.UniqueName = "column4";
cell.RowSpan = 3;
cell.ColSpan = 1;
view.RowTemplate.Rows[0].Cells.Add(cell);
 
//row2
cell = new CellDefinition();
cell.UniqueName = "column2";
cell.RowSpan = 2;
cell.ColSpan = 1;
view.RowTemplate.Rows[1].Cells.Add(cell);
 
cell = new CellDefinition();
cell.UniqueName = "column3";
cell.RowSpan = 2;
cell.ColSpan = 1;
view.RowTemplate.Rows[1].Cells.Add(cell);
 
cell = new CellDefinition();
cell.UniqueName = "column6";
cell.RowSpan = 1;
cell.ColSpan = 1;
view.RowTemplate.Rows[1].Cells.Add(cell);
 
//row3
cell = new CellDefinition();
cell.UniqueName = "column7";
cell.RowSpan = 1;
cell.ColSpan = 1;
view.RowTemplate.Rows[2].Cells.Add(cell);
 
radGridView1.ViewDefinition = view;

I have also updated your Telerik points for reporting this issue.

I hope this will help. Should you have further questions, I would be glad to help.

All the best,
Ivan Petrov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Zerka
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Share this question
or