Replies
For what it's worth, I set up a Session variable which points to the existing DataView. If I need to do anything with the data in the table, I change ANOTHER Session variable that points to a NEW DataView. I then assign the new DataView in the grid's OnPreRender. So I let it "update" that old DV and then just discard it. Annoying, but it's the only thing I've found that works.
Your OnPreRender would look like this:
protected void wgSalesRecords_OnPreRender(object sender, EventArgs e)
{
//Make the "old" one the new existing one that you're about to assign – the value that had been in Old before this call is just discarded
Session["OldSalesRecordsBinding"] = Session["NewSalesRecordsBinding"];
wgSalesRecords.ClearDataSource();
wgSalesRecords.DataKeyFields ="SaleDate,GroupDate";
wgSalesRecords.DataSource = Session["NewSalesRecordsBinding"];
wgSalesRecords.DataBind();
}
Well, that's sort of my point. The user is NEVER ALLOWED to change the data. EVER. I WANT any changes (although the only column even editable is the "Include" checkbox, which isn't part of the original data anyway) to be "lost". So although I can let it "update" some temporary data source, I would then have to just discard it.
I had tried to set AutoCRUD to false and then handle the OnRowUpdating (by simply having one line – e.Cancel = true;), but the error was triggered before that function gets called. Is there somewhere earlier I could intercept the "update" stuff and cancel it?
Is there no way to get it to NOT try to update the datasource? I've found references to turning off AutoCRUD and doing it manually, but even when I changed teh AutoCRUD setting to false it still tried to update automatically. I can try your workaround – I already have one session variable for the datasource, as I have to rebind on every postback. I suppose I can add another but it feels clunky to have an "OldDataSource" who's only purpose is to be ignored and keep WebDataGrid from throwing errors.