Hello,
I am trying to divide the column header of some columns in two with the HtmlViewDefinition of the RadGridView. My table is not so complex for the moment but I just can't make it work....
I attached an Excel file screenshot to this message so you can have a look to what I want to do and below is the code I wrote so far:
I have a binding list full of data in it which I give to the radgridview and then I define the view and apply the view to the radgridview after updating it.
With this code, the radgridview look like the screenshot radgridview result.
Any idea how to display the data correctly into the radgridview?
Thanks,
LB
I am trying to divide the column header of some columns in two with the HtmlViewDefinition of the RadGridView. My table is not so complex for the moment but I just can't make it work....
I attached an Excel file screenshot to this message so you can have a look to what I want to do and below is the code I wrote so far:
radGridViewSaleReport.DataSource = myList;
//binding list
HtmlViewDefinition view =
new
HtmlViewDefinition();
view.RowTemplate.Rows.Add(
new
RowDefinition());
view.RowTemplate.Rows.Add(
new
RowDefinition());
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Customer Name"
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Unit"
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Unit Type"
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Unit Area"
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Price/Sq.M."
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Selling Price"
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Initial booking"
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Booking"
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Signing Contract"
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Contract signed"
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Transfer"
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Sale"
));
view.RowTemplate.Rows[0].Cells.Add(
new
CellDefinition(
"Comment"
));
view.RowTemplate.Rows[1].Cells.Add(
new
CellDefinition(
"Amount"
));
view.RowTemplate.Rows[1].Cells.Add(
new
CellDefinition(
"Date"
));
view.RowTemplate.Rows[1].Cells.Add(
new
CellDefinition(
"Amount"
));
view.RowTemplate.Rows[1].Cells.Add(
new
CellDefinition(
"Date"
));
view.RowTemplate.Rows[1].Cells.Add(
new
CellDefinition(
"Amount"
));
view.RowTemplate.Rows[1].Cells.Add(
new
CellDefinition(
"Date"
));
view.RowTemplate.Rows[1].Cells.Add(
new
CellDefinition(
"Amount"
));
view.RowTemplate.Rows[1].Cells.Add(
new
CellDefinition(
"Date"
));
view.RowTemplate.Rows[0].Cells[0].RowSpan = 2;
view.RowTemplate.Rows[0].Cells[1].RowSpan = 2;
view.RowTemplate.Rows[0].Cells[2].RowSpan = 2;
view.RowTemplate.Rows[0].Cells[3].RowSpan = 2;
view.RowTemplate.Rows[0].Cells[4].RowSpan = 2;
view.RowTemplate.Rows[0].Cells[5].RowSpan = 2;
view.RowTemplate.Rows[0].Cells[9].RowSpan = 2;
view.RowTemplate.Rows[0].Cells[11].RowSpan = 2;
view.RowTemplate.Rows[0].Cells[12].RowSpan = 2;
view.RowTemplate.Rows[0].Cells[6].ColSpan = 2;
view.RowTemplate.Rows[0].Cells[7].ColSpan = 2;
view.RowTemplate.Rows[0].Cells[8].ColSpan = 2;
view.RowTemplate.Rows[0].Cells[10].ColSpan = 2;
radGridViewSaleReport.Update();
this
.radGridViewSaleReport.ViewDefinition = view;
this
.radGridViewSaleReport.TableElement.CellSpacing = -1;
this
.radGridViewSaleReport.TableElement.RowSpacing = -1;
I have a binding list full of data in it which I give to the radgridview and then I define the view and apply the view to the radgridview after updating it.
With this code, the radgridview look like the screenshot radgridview result.
Any idea how to display the data correctly into the radgridview?
Thanks,
LB