Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to delete the records on Button click on asp.net page via vb.net language
Posted

Hi ,
JavaScript
<script type="text/javascript">
       function confirmation() {
           if (confirm('are you sure you want to delete ?')) {
           return true;
           }else{
           return false;
           }
       }
   </script>


ASP.NET
<asp:button id="Button1" runat="server" text="Button" xmlns:asp="#unknown">
OnClientClick="return confirmation();" onclick="Button1_Click"/></asp:button>


Best regards
M.Mitwalli
 
Share this answer
 
Comments
Hareesh Malli 23-Dec-14 6:27am    
Best answer buddy. You just make it simple and saved my lot of time. Thanks
Mohamed Mitwalli 24-Dec-14 0:20am    
Thanks Hareesh :)
If you are looking for javascript confirm, try this
ASP.NET
<asp:button id="btnSubmit" runat="server" text="Delete" onclientclick="return confirm('Do you want to delete this record?');" xmlns:asp="#unknown" />
 
Share this answer
 
Hi

use on button click
C#
Response.Write("<script>return confirmation();" </script>");


Thanks
 
Share this answer
 
v2
That's very simple for populating confirmation box on button click:

ASP.NET
<asp:button id="btnDelete" runat="server" text="Delete" onclientclick="return confirm('Do you want to delete this record?');" xmlns:asp="#unknown" />


The above code will return true on click of OK and false on click of Cancel
Thanks
 
Share this answer
 
XML
<script type="text/javascript">
        function confirmation() {
            if (confirm('are you sure you want to delete ?')) {
            return true;
            }else{
            return false;
            }
        }
    </script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900