ts0

ts0

thoroughly scientific

follow me on Twitter!

Label for input in ASP.NET

Another ASP.NET 2 "secret" for you, this one courtesy of Ben Wards presentation at BarCamp.
AssociatedControlID will automatically write out the for attribute on the label. Saves you waiting till PreRender to get the right ClientId, and keeps UI logic where it should be. Obviously it's a label element and not a span which is what asp:label normally writes out.

Labels:

3 Comments - Post a comment

Nabeel

i am more of a vb.net guy .. do you use visual studio.net to code?

Thom Shannon

It doesn't matter what language you use to do this. But yeah I use VS, and I'm a C# guy :)

Michael James

cheers Thom for this tip, I made use of it today, had about 10 labels on a page for a form but had no idea how to tie them together, now it works great. Ta!
ts0

<< Back to home page


Friends



Find Me (and my Social Graph)



RSS Feed

Archives 08.06 09.06 10.06 11.06 12.06 01.07 02.07 03.07



Thomas Shannon-Smith
Tom Shannon-Smith
Tom Shannon
Thom Shannon-Smith