Datagrid not updating in an UpdatePanel

Here’s a fun bug I ran into today.  I had a datagrid that had a delete command in one of the columns.  The code worked find but the datagrid was not updating on the screen when a row was removed.  If you hit refresh after the command you would see that the update happened correctly.

The fix was very simple, but hard to figure out.  I had to create an empty function for the delete command in the pages code behind.  apparently Ajax was trying to fire the function which didn’t exist and crashing.

For the delete command I added the following function that fixed the issue, you may need to add others if your cashing on commands other then delete:

Private Sub GridView1_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GridView1.RowDeleting
 'Empty Method Needed So Ajax doesn't die...
End Sub

Leave a comment