Monday, April 22, 2013

GridView RowCommand : Do not use standard keyword ("Delete") etc if you want to use RowCommand only; Also only "ing" handler is required, not "ed" handler

RowCommand handling  : Note that standard commands fire standard events. The standard commands are “Edit”, “Delete”, “Update”, “Select”, “Sort” , “Cancel”,”Select”, “Page”. If you use any of these standard keywords, you must create their corresponding wired handlers. E.g. if you give the command name as CommandName = “Delete”, you must handle RowDeleting event, even though you may handle the actual deletion in the OnRowCommand handler.  If you do not want the default handlers to be fired and do all your work in RowCommand, you must use command name other that the standard comman. E.g. in the above case, you may use  CommandName =”Del” or CommandName=”DeleteRow”. This will not fire the RowDeleting handler.

NOTE : Only the “ing” handler is required, “ed” handler is not required.

No comments:

Post a Comment