ASP.NET server side element names changed?

As far as I’ve known if the ClientID of a server control looked someting like this:


Then the name sent on postback (which identified the control on the server side) was:


But since some time the _ to $ conversion is not true any more. Instead the _ signs are randomly replaced by dollar signs. Recently the name sent back on postback is:


This change screwed up quite a lot of client side manual __doPostback() codes I’ve written – most of the making these invokes due to JQuery addons.

I was notified by a client that recently a voting control I developed for them is not working any more. The control itself was a list of radio buttons transformed to stars with some javascript magic. On the client side I had to code that when the user clicks any radio button a the form gets submitted by imitating a LinkButton being clicked.

So this is the code I had in the aspx page that worked like a charm so far:

function SubmitVote() {

Now after this change no events were fired on the server side because of the control name not being valid.

Next try: instead of transforming the ID lets just get the name property from the control:

function SubmitVote() {

This solution didn’t work either as the control did not have a name attribute. So the way I dot the thing solved was by invoking the click event of the LinkButton:

function SubmitVote() {

And this was the way I managed to successfully invoke the __doPostback() method from client side. Actually it wasn’t really invoking but only immitating the user clicking.

If you’ve information on when (and why) this server control naming convention has been changed feel free to share within the comments.

2 Responses to ASP.NET server side element names changed?
  1. Nico Lubbers

    I experienced this behaviour too, but I found the solution in changing the web.config

    in the system.web section a tag xhtmlConformance mode=”Legacy|Transitional|Strict” can be added to change the way the name of the controls are rendered. The theory behind it I do not know (I think it was added for backward compatibility purposes).

    Regards, Nico

  2. Gergely Orosz

    Thanks for the info Nico. Good to know there’s a way to set it to be backward compatible… wish I knew why they had to change it.