Actually it is not possible to attach client confirmation to the delete command filed. But it is pretty easy to do this by template field. The only think you have to do is to set command name to be "Delete" (CommandName="Delete"). GridView event handlers are responsible for the other things of delete process.
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="delete1"
runat="server"
OnClientClick=
"return confirm('Are you sure you want to delete this record?');"
CommandName="Delete">Delete
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
No comments:
Post a Comment