I want to add a row above the coloumn headers to achieve something like this:
heading1 | Heading 2 | Heading 3 |
col1 | col2 | col3 | col4 | col5 | col 6 |
I tried creating a new UltraGridRow and adding UltraGridCell with the same colspan count as the number of columns.
UltraGridRow ugr = new UltraGridRow(); UltraGridCell ugcell = new UltraGridCell(); for (int i = 0; i <= groupCount; i++) { ugcell = new UltraGridCell(); ugcell.Style.HorizontalAlign = HorizontalAlign.Center; ugcell.ColSpan = 2; ugcell.Text = "test"; ugcell.Style.ForeColor = System.Drawing.ColorTranslator.FromHtml("#304E74"); ugcell.Style.VerticalAlign = VerticalAlign.Top; } UltraWebGrid1.Rows.Add(ugr);
UltraGridRow ugr = new UltraGridRow(); UltraGridCell ugcell = new UltraGridCell();
for (int i = 0; i <= groupCount; i++) { ugcell = new UltraGridCell(); ugcell.Style.HorizontalAlign = HorizontalAlign.Center; ugcell.ColSpan = 2; ugcell.Text = "test"; ugcell.Style.ForeColor = System.Drawing.ColorTranslator.FromHtml("#304E74"); ugcell.Style.VerticalAlign = VerticalAlign.Top; }
UltraWebGrid1.Rows.Add(ugr);
Do I need to do this at a particular event?
I was able to do this with a standard gridview in the rowcreated event by doing
gvw1.Controls[0].Controls.AddAt(1, gvr);
Thanks in advance for any help you can give me.
Hello Jack,
You can get that look by using Multi-Column headers feature of the WebGrid. Click here to see a sample that demonstrates it.
hth,
Taz.