Using JQuery Alert Message in Asp.Net C# VB.Net Application

We are lucky that JQuery now shipped with Visual Studio. In Visual Studio 2010 you will get by default “Scripts” folder in your project hierarchy. Just 3 files here: 1. jquery-1.4.1-vsdoc.js (For Visual Studio code intelligence), 2. jquery-1.4.1.js (Main JQuery Script File) 3. jquery-1.4.1.min.js (Minified version of main Jquery Script). You can use either main script file or minified version. But better to use the minified versiion to gain performence. I will also discuss about minified version & CDN version later. Here I am going to discus “How we can add JQery Alert Message Box in Asp.Net C# & VB.Net Application”.

To do that first drag either “jquery-1.4.1.js” or “jquery-1.4.1.min.js” file & drop it just under “BodyContent” line. Like Below:

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

Now write a simple Hello World!! Jquery Alert Message Box Function like below:

    <script type="text/javascript">

        $(document).ready(function () {
            alert('Hello World !!');

Note: The process is same for both C# & VB.Net Application.

Revision of Full Process:

Now run the project. You will get the JQuery Alert Box like below:

Download Code Example C#        Download Code Example VB.Net

Posted in .Net,, C#, Client, JQuery, VB.Net
One comment on “Using JQuery Alert Message in Asp.Net C# VB.Net Application
  1. Start Business in Delhi says:

    Very informative post for me as I am always looking for new content that can help me and my knowledge grow better.

Leave a Reply

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