V
Vishal
Hello,
I have a datagrid, which creates the columns
dynamically based on the columns in the dataset. Now I
need to add an additional row for each exisiting row AND
hide that row, by default. This row will contain my
usercontrol, which I will add also dynamically.
Unfortunaly I am not able to do so. I tried two options:
1.) I added the rows to the dataset and bound the dataset
to the datagrid.
- The problem however is, that I am not able to set the
span of that row somehow. I set it, but it doesnt take it.
- The second problem is that I am not able to hide it. I
dont see any attributes property for the DataRow. Here is
the code:
...begin loop through the rows
Dim NestedGridRow As DataRow = ds.Tables(0).NewRow
Dim NestedCell As New TableCell
NestedCell.ColumnSpan = 3 'ds.Tables(0).Columns.Count
ds.Tables(0).Rows.InsertAt(NestedGridRow, nRowPosition)
nRowPosition = nRowPosition + 2
...end loop through the rows
2.) I tried to add the columns direclty to the datagrid,
via the following code:
...begin loop through the rows
Dim dgItem As DataGridItem
Dim dgCell As TableCell
dgItem = New DataGridItem(0, 0, ListItemType.Item)
dgCell = New TableCell
dgCell.ColumnSpan = AADataGridStores.Columns.Count
dgItem.Cells.Add(dgCell)
dgCell.Text = "Testing something..."
Dim t As Table = AADataGridStores.Controls(0)
t.Rows.AddAt(nRowPosition, dgItem)
nRowPosition = nRowPosition + 2
...end loop through the rows
But this doesnt work too and it gives the error:
Specified argument was out of the range of valid values.
Parameter name: index
Now how I am supposed to add a new row which I can hide?
Manually, I would place the row into a placeholder and set
the placeholder property either to true/false. But I am
not getting how to do that in my situation. Can somebody
please help me with this one?
Thanks
I have a datagrid, which creates the columns
dynamically based on the columns in the dataset. Now I
need to add an additional row for each exisiting row AND
hide that row, by default. This row will contain my
usercontrol, which I will add also dynamically.
Unfortunaly I am not able to do so. I tried two options:
1.) I added the rows to the dataset and bound the dataset
to the datagrid.
- The problem however is, that I am not able to set the
span of that row somehow. I set it, but it doesnt take it.
- The second problem is that I am not able to hide it. I
dont see any attributes property for the DataRow. Here is
the code:
...begin loop through the rows
Dim NestedGridRow As DataRow = ds.Tables(0).NewRow
Dim NestedCell As New TableCell
NestedCell.ColumnSpan = 3 'ds.Tables(0).Columns.Count
ds.Tables(0).Rows.InsertAt(NestedGridRow, nRowPosition)
nRowPosition = nRowPosition + 2
...end loop through the rows
2.) I tried to add the columns direclty to the datagrid,
via the following code:
...begin loop through the rows
Dim dgItem As DataGridItem
Dim dgCell As TableCell
dgItem = New DataGridItem(0, 0, ListItemType.Item)
dgCell = New TableCell
dgCell.ColumnSpan = AADataGridStores.Columns.Count
dgItem.Cells.Add(dgCell)
dgCell.Text = "Testing something..."
Dim t As Table = AADataGridStores.Controls(0)
t.Rows.AddAt(nRowPosition, dgItem)
nRowPosition = nRowPosition + 2
...end loop through the rows
But this doesnt work too and it gives the error:
Specified argument was out of the range of valid values.
Parameter name: index
Now how I am supposed to add a new row which I can hide?
Manually, I would place the row into a placeholder and set
the placeholder property either to true/false. But I am
not getting how to do that in my situation. Can somebody
please help me with this one?
Thanks