Tech and a few other things RSS 2.0
# Sunday, October 24, 2010


Problem:
When I look for the id of an ASP.NET element with some sort of neat DOM querying language I can't find it.

Solution:
Remember ASP.NETer's ASP.NET renames the id from what you named it to something different when it writes the element out to the page. The good news is ASP.NET always names it to the same unique name (something like but not necessarily  ctl00_classname_controlname). Knowing this, you can run your page once and grab the id from the page source. Now use your super cool DOM querying language of choice to find that id by it's new proper ASP.NET name.

Explanation:
Why does ASP.NET do this? The good super geeks at Microsoft know that most of us, not you the reader of course, are not wise enough to give each ASP.NET element a unique name so they won't conflict with each other when ASP.NET is doing all its little magic tricks.

Once again this is a stupid little error that hung me up for more than I'd like to admit. I knew ASP.NET did this I just didn't piece together on why I couldn't find the element by id with my querying language.

Sunday, October 24, 2010 10:22:51 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
.Net | dojo | JQuery | Microsoft AJAX
Navigation
About the author/Disclaimer
        

My name is Ben Coffman. I like to build things: programs, programming teams, programming departments and maybe one day a company with lots of programmers. When I turn the internet off I focus on my family, random hobbies, and sharing moments in life.

Blogs I follow:

1. 2andahalfd.com

2. Jeff Lamarche

3. Scott Hanselman

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Ben Coffman

Archive
<February 2012>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910
All Content © 2012,

Sign In