Hi Guys,
I am using XamWebGrid to display records from sql. To pull data i am using domain context service. I have provided delete flexibility in grid but when user try to delete some rows i want to validate them against data in sql. I am making asyn call (calling service method) in RowDeleting event to check whether row can be deleted or not. As call is asyn, it doesn't wait for the result and simply remove the row from grid. It should wait for the result so that i can cancel event based on result. Anyone can help how to achive this?
Thanks in advance.
Hi,
So what i'd recommend is setting e.Cancel = true in the event.
Then store the row which you were trying to delete. When your async call comes back, if it says you can delete the row, call grid.Rows.Delete(row), and in the event this time, b/c you already have a reference to this row, you know to skip the validation check, and let it delete.
Or when the aync event comes back, you can simply just delete the data through the domain data source, and the grid will be updated automatically.
Hope this helps,
-steveZ