You need to reference the ClientID of the control; this is the id in the last html.
Of course, another approach could be to use some other attribute (like css, etc.) and use jQuery to find This; jQuery takes a lot of DOM pain from javascript. Interestingly, jQuery is now even supported by VS2008 (with intellisense, etc.).
I am currently reading jQuery in action , and I really like it. To give an example from a book (on the topic of radio):
var x = $('[name=radioGroup]:checked').val();
which returns the value of a single marked radio button in a group or undefined if none are selected.
Get a name; it uses the internal property UniqueGroupName , which does a lot of distortion. An option (but not attractive) would be to use reflection to read UniqueGroupName . Also, use something as simple as a literal control. Gawd I hate ASP.NET form model ... roll on MVC ...
Fianlly - I'm looking at the VS2010 CTP public now ; One of the new additions to ASP.NET is the static ClientID s by setting ClientIdMode = Static to the control. A little delay, but not unwanted.
source share