CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Ben Reichelt's Weblog


User Controls and javascript



Comments

Paul Wilson said:

Why? Because you can use a user control multiple times in the same page -- but the ids and names have to be guaranteed unique on the page.
# December 21, 2004 7:26 AM

ben said:

I had thought about duplicate names and ids, but I didn't think that was a good enough reason, it should be up to the developer to make sure they name their elements distinctly.

However, I had not considered using a user control multiple times on a page, in that case the developer simply cannot make distinct names, so in this case the behavior is warranted, good answer, thanks
# December 21, 2004 7:57 AM

Zk said:

To agree what Scott and Paul said, I *never* assume the client ID, even if I'm pretty darn sure (99.9%)... I'll always use the ClientID property.
# December 21, 2004 6:45 PM

ben said:

One thing I have been doing lately is to use the DOM to traverse form elements, that way I only need a reference to the table or div that contains all of the input boxes, etc..
# December 22, 2004 2:24 AM

jp india said:

how can i access the textbox of a user control inside control using javascript??
# July 5, 2005 8:21 AM
Check out Devlicio.us!

Our Sponsors