Hi ,
I am using ultrawebgrid to display timesheets. If the user selects a record in the grid,and click the delete button on key board, I wanted to delete that record from database and webgrid. And also to get the deleted record id.Can any one please send me the solution.Thanks in advance.
Handle the DeleteRow or DeleteRowBatch event of the grid. This will give you information as to what row was just deleted, so that you can update your database accordingly.
Thank you very much for your help.I tried delete row event on Ultra web grid.But i can't able to get the row id for the selected row.Can you please send me the code to delete the row by using delete row events. I checked allow row delte to true only.But still if i click delete button on the keyboard ,it's not deleting from the data base.Your help is much appreciated.
The DeleteRow server-side event is raised in response to a row being deleted on the client, not the other way around.
I'm not sure what ID you're looking for. If you mean the value of the primary key for the row you're deleting, as long as that column exists on your grid row, you can get it from the event arguments. For instance, if the Key of the grid column that represents your primary key is "PK", and assuming that the data is an integer, the following C# code will retrieve that information during the DeleteRow event:
int pk = (int) e.Row.Cells.FromKey("PK").Value;
Thank you very much for your help.Its working fine.Iam getting the primary key value during DeleteRowEvent.And passing that value to delete the record in the back end.