devpro
June 19th, 2001, 01:25 PM
Does anyone know how to add a javascript function that ask the user to confirm the deletion of a DataGrid record before deleting it? I need to add
this javascript to a asp:DeleteCommandButton. Has anyone already done something like this?
In the ASPX page I have this column to show the delete icon:
<asp:ButtonColumn ButtonType="LinkButton" Text="" CommandName="delete"
/>
If I look at the HTML code generated, I have the following:
Now, I want to use the following js to ask confirmation:
javascript:if( confirm('Are you sure you want to delete this record?') == true )
document.Form1.submit();">
I know I could use:
but of course the problem is that I can't know the javascript produced by ASP.NET for each single row at design time!!!
I think confirmation before deletion is a must for a editable grid. Any solution? Thank you!
- Gianni
- devpro
this javascript to a asp:DeleteCommandButton. Has anyone already done something like this?
In the ASPX page I have this column to show the delete icon:
<asp:ButtonColumn ButtonType="LinkButton" Text="" CommandName="delete"
/>
If I look at the HTML code generated, I have the following:
Now, I want to use the following js to ask confirmation:
javascript:if( confirm('Are you sure you want to delete this record?') == true )
document.Form1.submit();">
I know I could use:
but of course the problem is that I can't know the javascript produced by ASP.NET for each single row at design time!!!
I think confirmation before deletion is a must for a editable grid. Any solution? Thank you!
- Gianni
- devpro