Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am binding user data on page load event.if user change data and click on save button than confirm message display to user using javascript.if user click on OK button then data get updated in database and if user click on cancel button data not updated in database.

regards,
Manohar
Posted

See this
C#
<asp:button id="save_detail" runat="server" text="Save" onclick="save_detail_Click" onclientclick="return confirm('Are you sure you want to save selected records?');" />

If you click yes then only OnClick event will get called.

Regards..
 
Share this answer
 
v3
Comments
Nandakishore G N 26-Sep-13 5:06am    
good answer.my 5
XML
<script type='text/javascript'>
    document.getElementById("someButtonId").onclick = function() {
        var confirmation = window.confirm("Are you sure?"); //confirmation variable will contain true/false.

        if(confirmation) { /* Write code for Yes */ }
        else { /* Write code for No */ }
    }
</script>


try this code
 
Share this answer
 
See this one, for confirm msg.
C#
<asp:Button runat="server" Text="Try it now" OnClientClick="if(confirm('Format the hard disk?'))
alert('You are very brave!');
else alert('A wise decision!')" style="font-weight: 700; color: #006666"
            Width="84px" />

Thank u.
 
Share this answer
 
This thing can be easily done with the help of javascript and the Solution 1 is correct .
The second option is use the Ajax control named as ConfirmButtonExtender
 
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