RowUpdating not firing!!!

I create a simple function to update some data in the GridView.

And I add a Edit button, when the edit button is clicked in a GridView control, the row is redisplayed in edit mode:

<asp:CommandField ButtonType="Image"
EditImageUrl="~/images/i_edit.gif"
ShowEditButton="True" />


In edit mode, with the data available in editable controls such as TextBox and CheckBox controls. The Edit button becomes an Update or Save button, and when users click it, the RowUpdating event will be firing.

when I finish my code, when I click the "Update link", the RowUpdating event is not firing!!!
I try to debug it, yes, it is totally not firing the RowUpdating event. I dont know what happen?!?!

Finally, I found the problem, Which is because I set the ButtonType="Image", I want used an icon become a button, and I also set EditImageUrl="~/images/i_edit.gif", but I leave the UpdateImageUrl blank!?!?! so that why it cannot call the RowUpdating event.

<asp:CommandField ButtonType="Image"
EditImageUrl="~/images/i_edit.gif"
UpdateImageUrl="~/images/i_save.gif"
CancelImageUrl="~/images/i_cancel.png"
ShowEditButton="True" />

0 comments: