Showing posts with label JavaScript Alert Dialog Box. Show all posts
Showing posts with label JavaScript Alert Dialog Box. Show all posts

Tuesday, 18 April 2017

How to use JavaScript Alert Dialog Box in Asp.Net?

In this post, I will explain how to use JavaScript Alert dialog box in Asp.Net?. 

While writing program much time a situation comes where the programmer wants to give warning or alert message to the user and this can be done by using JavaScript Alert Dialog box. JavaScript supports three important types of dialog boxes. These dialog boxes can be used to raise an alert, or to get confirmation on any input or to have a kind of input from the users. Here we will discuss Alert Dialog Box.

An alert dialog box is mostly used to give a warning message to the users or alert dialog box can be used to give informative messages to the user. 

An alert dialog box is displayed using a method alert(). The alert method takes one parameter (A label which you want to display in the text box. The alert dialog box gives only one button OK to select and proceed.

For example, if one input field requires to enter some text but the user does not provide any input, then as a part of the validation, you can use an alert box to give a warning message.

HTML Code - 

<html  lang="">
   <head>
      <title>How to use JavaScript Alert Dialog Box in Asp.Net</title>
      <script type="text/javascript">
            function GiveAlert() {
               alert ("This is a warning message for user!");
            }
      </script>
   </head>

   <body>
      <form>
         <input type="button" value="Click Me For Alert Dialog Box" onclick="GiveAlert();" />
      </form>
   </body>
</html>