I have a datagrid that has many editable fields on the grid. When the user is done, they click save and it updates all the rows. The dataset is populated via a stored procedure. This all works great.
The problem I have now, is when they click on the "Add Items" box to add a new row to the table, and if they didn't save their changes to the page first before adding the new row, they lose the changes.
I was wanting to do something like "AcceptChanges" before it adds the new row of information, but when I check the rowstate of rows I have edited in the datagrid, it always says unchanged.
I've tried to check the viewstate of the dataset and also the dataset itself to see the new values but they never appear. Am I looking at the wrong thing? (dsPricing is a declared at the beginning of the class)
The problem I have now, is when they click on the "Add Items" box to add a new row to the table, and if they didn't save their changes to the page first before adding the new row, they lose the changes.
I was wanting to do something like "AcceptChanges" before it adds the new row of information, but when I check the rowstate of rows I have edited in the datagrid, it always says unchanged.
I've tried to check the viewstate of the dataset and also the dataset itself to see the new values but they never appear. Am I looking at the wrong thing? (dsPricing is a declared at the beginning of the class)
Code:
Dim _NewDataRow As DataRow
dsPricing.AcceptChanges()
_NewDataRow = dsGrid.Tables(0).NewRow
_NewDataRow("CapsContractItemID") = 0
_NewDataRow("BillToNum") = strBillToNum
_NewDataRow("DeleteItemFlag") = 0
_NewDataRow("ShowItemFlag") = 1
dsPricing.Tables(0).Rows.InsertAt(_NewDataRow, 0)
dsPricing.AcceptChanges()
'rebind ds to datagrid
grdPricing.DataSource = dsPricing
grdPricing.DataBind()