Diggety? And ClientID "Unmangling"

I noticed Digg was down this morning ("metropolitan network problems") so I missed my morning DiggFix.

But when I stopped back during lunch to check out some post about a new NanoCrystal Display technology, I got a laff from one comment:


"HOLY CRAP GUYS THIS IS IT. THIS IS THE REVOLUTION. IT STARTS NOW WTFOMGWTF!!!!!!!!WE COULD BEND THE TV WTFOMGWTF!!!!!!!! BEND IT BABY!! BEND IT LIKE BECKHAM!!!!!!!!OOOOOHHH YEAAHHHH!!!!!!!!!!! MY BENDY LAPTOP IS GONNA RUN FOOOOREVER!!!!!!!FUEL CELL BATTERY PLUS NANOCRYSTAL DISPLAY 4 LYFE MOTHER****** CRADLE 2 DA GRAVE BABYWTFOMGWTF!!!!!!!


This, folks is what happens to otherwise perfectly normal geeks who spend too much time on Digg. Their minds get DiggF*cked!

Sadly, there is no known cure.

ClientID Unmangler:



In other news, I've noticed that the concept of "not being able to get the eventual correct ClientId" of an element when using MasterPages is showing up on forums and newsgroup postings in ever - increasing numbers.

Let me give an example of one way to do this:


private string script = "[Label1ID].innerHTML = 'boo!';";
private string scriptKey = "hello";
private bool addScriptTags = true;
protected void Page_Load(object sender, EventArgs e)
{
script = script.Replace("[Label1ID]",Label1.ClientID);
ClientScript.RegisterStartupScript(this.GetType(), scriptKey, script, addScriptTags);

What this does, very simply, is inject a javascript variable into the page with the "real" ClientId including all the MasterPage and any other namingcontainer mangling that ASP.NET uses to disambiguate control id's.

( boy, that was a mouthful. I better look that one up in my Hillbilly SpellChecker.)


Comments

  1. Anonymous3:05 PM

    In-diggity-deed, neighbor!

    ReplyDelete
  2. Rick,
    Nice post. As a matter of fact I was about to go visit your stuff to find something else that I remembered you had figured out and written about. Problem is, I can't remember what it was -- Let's try some coffee...

    Your blog has earned a spot on my "hot list" because of the huge amount of valuable stuff you write about.

    ReplyDelete

Post a Comment

Popular posts from this blog

Some observations on Script Callbacks, "AJAX", "ATLAS" "AHAB" and where it's all going.

IE7 - Vista: "Internet Explorer has stopped Working"

FIREFOX / IE Word-Wrap, Word-Break, TABLES FIX

System.Web.Caching.Cache, HttpRuntime.Cache, and IIS Recycles

FIX: Requested Registry Access is not allowed (Visual Studio 2008)