Hi everyone,
I have a WebGrid showing 3 records from Table#1 that is related to another Table#2 (using Primary and Foreign keys)
When I select any row and hit the [DELETE] key this is what happens :
1. it goes ahead and deletes the selected row from the WebGrid. (now I have 2 rows)2. I catch the exception and show an error message (cuz it tried to delete a record related to Table#2) 3. the page now shows the WebGrid with TWO records but WITHOUT the deleted row.
If I go and select any of the remaining 2 records this is what happens :
4. it goes ahead and deletes the selected row from the WebGrid (now I have 1 row)5. I catch the exception and show an error message (cuz it tried to delete a record related to Table#2) 6. the page now shows the WebGrid with TWO records AGAIN but WITHOUT the deleted row. It shows the record I deleted in Step 1 AND the record I haven’t deleted yet.
What I need is the complete set of 3 records back in the WebGrid AFTER catching the exception.
What can I do ?
Regards.
without any code it is hard to know. But, you might want to look at just rebinding the data grid.
There is a function you can use.
OnDeleteRow
you can check for your record deletion code in this event then cancel if the delete is invalid.