This project is read-only.

Project Description

Awesome.ClientID is a HTTPModule which serializes the ClientID of server controls, and page/usercontrol properties to a JSON Array to make working with JavaScript easier without the need for outputting ClientID's. It's a solution for clean ClientIDs for .NET 2.0/3.5

Quick blogpost about Awesome.ClientID :)

Serialized Control ID's

As we know, ClientID's are rather annoying in .NET 2.0/3.5, altho we know we have given our control a Unique ID, ASP.Net decides that it's still not unique enough and add's it's own fluff. Thats where Awesome.ClientID comes to the rescue.

Awesome.ClientID iterates over the controls looking for specific controls such as TextBox's, Buttons, DropDownLists... etc, and serializes them to a JSON Array in the HTML document for use in JavaScript. This allows us to stop doing:

var userNameTextbox = document.getElementById(<%= txtUserName.ClientID %>);

And start writing something much nicer and cleaner:

var userNameTextbox = document.getElementById(controls.txtUserName);

Not only do we not have to put spaghetti code in our presentation, we can move that JavaScript into an external file!

Serialized Properties! 

Another feature in Awesome.ClientID, which makes it useful for .NET 4.0, is the ability to serialize Page/User Control properties.

All properties that are protected or public can be serialized to a JSON array at the same time the controls are serialized. Checkout the documentation for more information.

Last edited Dec 30, 2010 at 12:25 PM by NaturalCause, version 5