show Alert and Confirmation Message box in ASP.NET
Alert Message Box
This type of Message Box is used to give alert information to the user. This can be done using the "alert" method. Use the alert method in tags by using a function with a method name. Call this function on client click event in a Button as follows in the following code.
e.g.: alert("write Message here")
Confirmation Message Box
This type of Message Box is used to give a warning to the user. Suppose user is deleting records; at that time this type of message box is used to give confirmation about the action to be taken or not by showing two Buttons as "OK'" and "Cancle". If the user clicks on the "OK" Button it returns Boolean "True" and for "Cancel" button it returns Boolean "False".
This type of Message Box is used to give alert information to the user. This can be done using the "alert" method. Use the alert method in tags by using a function with a method name. Call this function on client click event in a Button as follows in the following code.
e.g.: alert("write Message here")
<title>show Alert and Confirmation Message box in ASP.NET</title> <script language="javascript" type="text/Javascript"> function alert_box() { alert("Client Side MessageBox"); } </script>
<asp:button id="btnLogin" onclientclick="alert_box();" runat="server" text="Login"> </asp:button>
This type of Message Box is used to give a warning to the user. Suppose user is deleting records; at that time this type of message box is used to give confirmation about the action to be taken or not by showing two Buttons as "OK'" and "Cancle". If the user clicks on the "OK" Button it returns Boolean "True" and for "Cancel" button it returns Boolean "False".
<asp:button id="btnDelete" onclick="btnDelete_Click" onclientclick="return confirm("Do you want to delete user ?");" runat="server" text="Delete"> </asp:button>
show Alert and Confirmation Message box in ASP.NET
Reviewed by Bhaumik Patel
on
1:29 AM
Rating: