S
ShamusFu
I added a second header row to my datagrid with spanned columns for
looks, but it seems when I post back from other buttons on the page,
the bound data in the rows disappears one at a time. The data is not
deleted, since when I edit the DG it all comes back, but it looks
ugly. You can press a submit button on the page for some other action
and the row data disappears one at a time. The rows are still there,
they just have blank cells.
Here is the code for adding another header row and spanning:
Dim dgitem As New DataGridItem(0, 0, ListItemType.Header)
Dim emptycell As New TableCell
emptycell.ColumnSpan = 2 'Set it to the colspan that you want
emptycell.Text = ""
Dim headcell As New TableCell
headcell.ColumnSpan = 3 'Set it to the colspan that you want
headcell.Text = "Head circ.(ofc)"
headcell.Font.Bold = True
Dim lenghtcell As New TableCell
lenghtcell.ColumnSpan = 3 'Set it to the colspan that you want
lenghtcell.Text = "Length/height"
lenghtcell.Font.Bold = True
Dim weightcell As New TableCell
weightcell.ColumnSpan = 3 'Set it to the colspan that you want
weightcell.Text = "Weight"
weightcell.Font.Bold = True
Dim bmicell As New TableCell
bmicell.ColumnSpan = 2 'Set it to the colspan that you want
bmicell.Text = "BMI"
bmicell.Font.Bold = True
Dim editcell As New TableCell
editcell.ColumnSpan = 2 'Set it to the colspan that you want
editcell.Text = ""
dgitem.Cells.Add(emptycell)
dgitem.Cells.Add(headcell)
dgitem.Cells.Add(lenghtcell)
dgitem.Cells.Add(weightcell)
dgitem.Cells.Add(bmicell)
dgitem.Cells.Add(editcell)
dgPatientData.Controls(0).Controls.AddAt(0, dgitem)
looks, but it seems when I post back from other buttons on the page,
the bound data in the rows disappears one at a time. The data is not
deleted, since when I edit the DG it all comes back, but it looks
ugly. You can press a submit button on the page for some other action
and the row data disappears one at a time. The rows are still there,
they just have blank cells.
Here is the code for adding another header row and spanning:
Dim dgitem As New DataGridItem(0, 0, ListItemType.Header)
Dim emptycell As New TableCell
emptycell.ColumnSpan = 2 'Set it to the colspan that you want
emptycell.Text = ""
Dim headcell As New TableCell
headcell.ColumnSpan = 3 'Set it to the colspan that you want
headcell.Text = "Head circ.(ofc)"
headcell.Font.Bold = True
Dim lenghtcell As New TableCell
lenghtcell.ColumnSpan = 3 'Set it to the colspan that you want
lenghtcell.Text = "Length/height"
lenghtcell.Font.Bold = True
Dim weightcell As New TableCell
weightcell.ColumnSpan = 3 'Set it to the colspan that you want
weightcell.Text = "Weight"
weightcell.Font.Bold = True
Dim bmicell As New TableCell
bmicell.ColumnSpan = 2 'Set it to the colspan that you want
bmicell.Text = "BMI"
bmicell.Font.Bold = True
Dim editcell As New TableCell
editcell.ColumnSpan = 2 'Set it to the colspan that you want
editcell.Text = ""
dgitem.Cells.Add(emptycell)
dgitem.Cells.Add(headcell)
dgitem.Cells.Add(lenghtcell)
dgitem.Cells.Add(weightcell)
dgitem.Cells.Add(bmicell)
dgitem.Cells.Add(editcell)
dgPatientData.Controls(0).Controls.AddAt(0, dgitem)