G
Guest
I have a datagrid that reads several rows of data from the database and loads
them on the screen.
Now I want to dynamically add a new row and assign the cells in the new row,
values.
When I try to create a datagridItem, I use the following call:
int newIndex = datagrid1.Items.Count; // returns 15 the current number of
rows in the grid
datagrid1.Items[newIndex].DataItem = new DataGridItem(newIndex, ?,
ListItemType.Item);
I get an error on the first parameter. It says that my index should not be
zero and be less than the collection count. (while I know that newIndex is
15) I don't know what to put for the 2nd parameter since I am not reading the
data for this row from database(datasource). I am pretty sure the third
parameter is correct.
After and if I can get this to work, how do I bind the new data to this row?
ANy help will be greatly appreciated.
Thanks
Any help is greatly appreciated.
them on the screen.
Now I want to dynamically add a new row and assign the cells in the new row,
values.
When I try to create a datagridItem, I use the following call:
int newIndex = datagrid1.Items.Count; // returns 15 the current number of
rows in the grid
datagrid1.Items[newIndex].DataItem = new DataGridItem(newIndex, ?,
ListItemType.Item);
I get an error on the first parameter. It says that my index should not be
zero and be less than the collection count. (while I know that newIndex is
15) I don't know what to put for the 2nd parameter since I am not reading the
data for this row from database(datasource). I am pretty sure the third
parameter is correct.
After and if I can get this to work, how do I bind the new data to this row?
ANy help will be greatly appreciated.
Thanks
Any help is greatly appreciated.