Use JavaScript alert() box in ASP.Net

In this article i will explain how to use javascript alert box in

we use alert box mostly for a giving a warning message to user.
we use alert box for validation purpose, if there is empty textbox while submitting form we display message in alert box enter some value.

Here we will learn with an ASP.Net Example.

Write javascript alert() box code in <head> tags like below :

<head runat=”server”>
<script type=”text/javascript” language=”javascript”>
function mm()
alert(“Hi Meera Academy”);

First Design web form for learn javascript alert() box.

JavaScript alert() box in
JavaScript alert() box in

Here is the Button control code :

 <asp:Button ID=”Button4″ runat=”server” Font-Bold=”True”
Text=”JavaScript Alert()” onclientclick=”mm()” Height=”35px” />

Here we use onclientclick property of button control for call javascript function.

JavaScript alert() box in
JavaScript alert() box in

I hope this example of use alert box will help you…

Leave a Reply

Your email address will not be published. Required fields are marked *