How to use messagebox to confirm deletion in gridview
-
I have a gridview contians row command field, "Delete", I want to popup a messagebox after user click on "Delete" to confirm deletion before the row has been actually deleted. Any way to do it?
-
I have a gridview contians row command field, "Delete", I want to popup a messagebox after user click on "Delete" to confirm deletion before the row has been actually deleted. Any way to do it?
There are two options to do that: + In the handler of the
RowCreated/RowDataBound
event of the GridView control, you can access the Delete button control from a specified cell, and assign the confirm script method to theOnClientClick
property of the button control. + Convert theCommandField
to theTemplateField
, you then easily set the confirm message box to the Delete button.