This project is read-only.
Project Description
A web control that performs an jQUery include, it not only checks to see if the jQuery control has been rendered before, if not render it but also allows you to simply specify the jQuery version, path to the file and which type to use, normal, minified or packed.

How To Use It

So add a register assembly into the top of your aspx file

<%@ Register Assembly="jQueryWebControl" Namespace="jQueryWebControl" TagPrefix="jQuery" %>

Then which ever page, master page or even web control will need jQuery add the jQuery Web Control.

<jQuery:jQuery runat="server" ID="jQuery"/>

As the control checks to see if a jQuery control has rendered before you don't have to worry about only including the control once. This should ensure you don't have to waste time checking but also means your controls can be used independantly in different sites.

Using the three optional parameters, Version, Type and Path.

Version - this is just a string parameter that allows you to specify the version of jQuery to use. E.G "1.2.2" - if this is left out then the control defaults to 1.2.0

Type - again a string parameter, this time with three options, empty string "" = default / development version, "min" = minified version, "pack" - the packed version for people who cant serve up gzipped files. - if left the control defaults to the normal development version

Path - a string parameter indicating the path to the javascript files. E.G "/javascript/jquery". - if left the control defaults to the /javascript/

It is worth noting that the control expects you to host the jQuery files, so in order to render the script tag for version 1.2.2 pack'd jQuery file you will need jquery.1.2.2.pack.js in the location you specify with the path parameter.

Example of use using parameters

<jQuery:jQuery runat="server" ID="jQuery" Version="1.2.2" Type="min" Path="/javascript/jQuery/"/>

I personally have made use of the version parameter the most as it has means different sites that have been developed against different jQuery releases can be updated / forced to use one version of the library. It also works best if all your jQuery files are in one centralised location, using a virtual directory or a shared location.

So hope you like the control, let me know any thoughts, comments or improvements and enjoy.

Last edited May 16, 2008 at 11:50 PM by MJJAMES, version 3