Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
Javascript confirm box on button click in asp.net
8184 Views
Introduction  
Confirm box is used to display a message and get the user input(yes or no).
Example
<asp:Button ID="Login" class="button_example" runat="server" Text="Login" onclick="Login_Click"
ValidationGroup="login_gr" Height="38px" OnClientClick="return confirm('Would you want to redirect');" />
Explanation of example 
When you click any button event the onclientclick called first and then onclick called.So in the above example in onclientclick the confim script written.If you click 'ok' in the confirm box it return true so that the onclick event called.If you click 'cancel' it return false so that the onclick not called.
Preview of confirm box 
Best Lessons of "Asp.net/Ado.net/C#.net(Dotnet)"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details