Showing posts with label Confirm Box Samples. Show all posts
Showing posts with label Confirm Box Samples. Show all posts

Apr 9, 2013

How to Show Message box from asp.net?

 
In Asp control button clicking the event showing message box from Client side with display the message box  Ok or cancel button. While Clicking Ok button to move to server side calling to method otherwise cancel means close the message box.

Asp Control:
 
 <asp:Button ID="btn_Add" runat="server" Text="Submit" OnClick="btnAdd_Click"  OnClientClick="javaScript:return btnClick();" />
 
Server Side method:
 
  protected void btnAdd_Click(object sender,EventArgs e)
    {
 
     }
 
 
Client Side method:
Confirm Box:
  <script type="text/javascript">
        function btnClick() {
            var r = confirm("Are sure you want to Add...");
            if (r == true) {
                return true;
            }
            else {
                return false;
            }
        }
</script> 
 
Prompt Box:
<script type="text/javascript">
function btnClick() {
            var x;
            var person = prompt("Please enter your name", "ID");
            alert(person);
            if (person != null) {
                document.getElementById("hdn_demo").innerHTML = person;
            }
        }
</script> 
Recent Posts
Popular Articles

 

© 2013 MUNISH ORACLE DBA& .Net Developer. All rights resevered. Designed by Templateism

Back To Top