I’ve been reading a lot about jQuery lately (actually since last month) but more so lately because I’d like to know what the buzz is all about. When I first heard about it last year, I simply just ignored it because I know that jQuery is only one of many UI libraries out there. When Microsoft announced that Visual Studio 2008 officially supported the framework via its intellisense, I started paying attention. Now jQuery is becoming more and more popular these days and I’ve noticed that a lot of web sites tends to learn more towards web 2.0 interface now. The UI side of things has finally come back and emerge back in the scene in terms of web development.
What is jQuery?
jQuery in Visual Studio 2008
Since most of my development efforts are done using VS 2008 (VW Express 2008 @ home), I’ll share some of the things that can make life easier when getting started with jQuery. Most of the things that I have learned is through this post by Scott Guthrie, which pretty much highlights what is required for jQuery to work with Visual Studio 2008.
Steps to make intellisense work:
1. Install the Visual Studio 2008 Service Pack 1.
2. Install the hotfix or patch for –vsdoc.js to enable JScript editor support.
3. Download jQuery and Visual Studio documention into your project. As of current post, the version is 1.3.1. You will need to download both files as both are required (the actual library and the VS-doc for intellisense support).
The main thing to keep in mind is to make sure that the naming of the files are identical (less the ‘-vsdoc’) since this is how the file is recognized in the VS environment.
Since I will be using the jQuery library quite often, the best approach that I’ve found is to include it within your Masterpage file to simplify your development efforts. That’s why we’re using jQuery to begin with –to keep things programmatically simple.
Within your Masterpage file’s <header> attribute, you can add a reference by writing the code as such and include a <asp:ContentPlaceHolder> for individual pages scripts:
<asp:ContentPlaceHolder ID="contentHeader" runat="server">
<asp:Content ContentPlaceHolderID="contentHeader" runat="server">
// Check if document has been fully loaded
// Your code here
<asp:Content ContentPlaceHolderID="contentBody" runat="server">
<a href="#">Click here</a>
Outsourcing the jQuery library:
I hope that this post provides some help and/or insights as to utilizing jQuery in your ASP.NET development.