Using jQuery with ASP. NET-A Beginner's Guide

Source: Internet
Author: User
Tags jquery library

Using jQuery with ASP. NET-A Beginner's Guide

Did you hear about jQuery... NO ...? It's fantastic !!Well if you have been hearing those words more too often from your colleagues but haven't had the chance to need e jQuery yet, then here's this beginner guide for you to get started with jQuery and ASP. NET.

Update:I have written an EBook on using jQuery with ASP. NET Controls. It's called"51 Tips, Tricks and Recipes with jQuery and ASP. NET Controls".

OK, the million dollar question-What is jQuery anyways?

JQuery is a fast, lightweight JavaScript library that is CSS3 compliant and supports extends browsers. The jQuery framework is extensible and very nicely handles DOM manipulations, CSS, AJAX, Events and Animations.

What is the difference between JavaScript and jQuery?

JavaScript is a language whereas jQuery is a library written using JavaScript.

Where can I download jQuery?

The latest version of jQuery as of this writing is jQuery 1.2.6 and can be downloaded from here .[Update] An updated version of jQuery 1.3.2 has been released. jQuery 1.3.2 and jQuery 1.3.2 Visual Studio 2008 Autocomplete documentation. so whereever you see 1.2.6 mentioned in the rest of this article, just replace it with 1.3.2.

What has Microsoft got to do with jQuery?

In ScottGu's blog, there was an announcement made a few weeks ago that Microsoft will be ering with the jQuery team and shipping jQuery with Visual Studio in future. also, jQuery intelliisense annotation support will be available as a free web-download. barely a few weeks after the announcement, Microsoft during the PDC event (held in the last week of October), announced that Visual Studio 2008 now supports jQuery intelliisense through an additional file available from jQuery. this file can be downloaded from here. for those interested, the release notes can be found here 1.2.6 (Release Notes ).

A few days ago, Microsoft also released a VS2008 SP1 Hotfix to support all JavaScript files including jQuery intelliisense for Visual Studio 2008. note that this hotfix works only if you have VS 2008 with SP1 or Visual Web Developer Express Edition with SP1. You can download the Hotfix from here (Downloads tab ).

Checking out jQuery intelliisense in Visual Studio 2008 with SP1

Assuming you have installed the hotfix, downloaded the jQuery library and the jQuery VS 2008 intelliisense documentation, follow these steps to move ahead.

Open Visual Studio 2008> File> New> Website> Choose 'asp. NET 3.5 website 'from the templates> Choose your language (C # or VB)> Enter the location> OK. in the Solution Explorer, right click your project> New Folder> rename the folder as 'scripts '.

Right click the Scripts folder> Add Existing Item> Browse to the path where you downloaded the jQuery library (jquery-1.2.6.js) and the intelliisense documentation (jquery-1.2.6-vsdoc.js)> Select the files and click Add. the structure will look similar to the following:

Now drag and drop the jquery-1.2.6.js file from the Solution Explorer on to your page to create a reference as shown below

Note:Since you have applied the hotfix, you do not have to manually add a reference to the jquery-1.2.6-vsdoc.js file in your page. once the reference to the runtime library has been added, Visual Studio automatically searches for the 'vsdoc 'file and loads it. you just need to keep both the runtime library and the documentation file next to each other.

To test intelliisense, add a <script> block and key in '$ ('. You will get an intelliisense similar to the one shown below:

Show me some examples

This article wocould be incomplete without examples. So let us quickly see some.

Example 1-Display an alert on asp: Button click using jQuery

 

From: http://www.dotnetcurry.com/ShowArticle.aspx? ID = 231 & AspxAutoDetectCookieSupport = 1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.