A better solution to find ASP.NET ClientIDs with jQuery
A small routine that returns us a jQuery object based on only the id:
function $$(id, context) {
var el = $("#" + id, context);
if (el.length < 1)
el = $("[id$=_" + id + "]", context);
return el;
}
So in simple usage to select my ctl00_MainContent_txtSymbol value both of the following work:
alert( $$("txtSymbol").attr("id") );
Or if I want to be specific about the container:
alert( $$("txtSymbol",$("#wrapper")).attr("id") );
Via A generic way to find ASP.NET ClientIDs with jQuery – Rick Strahl’s Web Log
Paging and Sorting ListView Control with jQuery Tablesorter plugins within ASP.NET MVC
This article provides a simple example of using jQuery along with the jQuery tablesorter and tablesorter.pager plug-ins to provide sorting and paging support for a listview within the context of an ASP.NET MVC application.
Form Validation using jQuery Validation plugin
In the example above, we only used three validation methods (
required,url). There are several other methods that can be used here. Here are a few of them:
remote: requests a resource to check the element for validity.min: makes the element require a given minimum.date: makes the element require a date.creditcard: makes the element require a credit card number.equalTo: requires the element to be the same as another one.You can find an exhaustive list of built-in validation methods at http://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation_methods.
But I can’t find a suitable built-in method for my situation. Can I write my own method?” Yes you can! And its really easy.
Writing Your Own Validation Method
Calling the
jQuery.validator.addMethod()method. It takes three parameters:
name: The name of the method, used to identify and referencing it, must be a valid javascript identifier.method: the actual method implementation, returning true if an element is valid.message: The default message to display for this method.In the validate function, we specify that the ’sport’ field should be validated using the
selectNonemethod.Make sure to look at the source code behind these demos
Via Form Validation using jQuery
Another tutorial here
Create Simplest Accordion Menu using jQuery
Step 1: Create HTML for your Menu
Step 2: Apply some style to your Menu using CSS – (optional using Round Corner CSS w/o images)
Step 3: Give life to your Menu using jQuery – using .click, .slideUp, .slideToggle
Via Accordion Menu: Create Simplest Accordion Menu using jQuery | ViralPatel.net
How to use Firebug to learn jQuery
A 9:59m video:
If the HQ version of the YouTube video still isn’t legible enough for you, Craig also made a full resolution WMV available as well.
Bookmarklet uses in the video
- Inject jQuery into any web page: jQuerify
- Point & Click CSS Selector: SelectorGadget
Via Updated: See how I used Firebug to learn jQuery | Encosia
Microsoft Ajax CDN and the jQuery Validation Library
- http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.js
- http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js
- http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2-vsdoc.js
- http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate.js
- http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate.min.js
- http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate-vsdoc.js
Scott Guthrie announced the launch of the Microsoft Ajax CDN on his blog last night. If you have not read his post, I recommend that you read it now to get a general overview of the CDN and how you can take advantage of the CDN to improve the performance of your ASP.NET Web Forms and ASP.NET MVC applications:
http://weblogs.asp.net/scottgu/archive/2009/09/15/announcing-the-microsoft-ajax-cdn.aspx
“The Microsoft Ajax CDN enables you to significantly improve the performance of ASP.NET Web Forms and ASP.NET MVC applications that use ASP.NET AJAX or jQuery. The service is available for free, does not require any registration, and can be used for both commercial and non-commercial purposes.
ASP.NET 4.0 will make it especially easy for ASP.NET Web Forms developers to take advantage of the CDN. By setting one property of the ScriptManager control – EnableCdn=true, you will be able to redirect all requests for the built-in ASP.NET JavaScript files to the CDN and improve the performance of your Web Forms applications.”
In his announcement, Scott describes how both the ASP.NET Ajax and the jQuery libraries are included in the CDN. There is one more set of JavaScript files that are added to the CDN today that Scott did not announce: the jQuery Validation library.
If you are not familiar with the jQuery Validation library then you should know that this is one of the most popular form validation libraries used by jQuery developers. Microsoft is shipping the jQuery validation library with both ASP.NET Web Forms and ASP.NET MVC in Visual Studio 2010. Furthermore, jQuery Validation library will be integrated with ASP.NET MVC.


