ClientID in Request.Form

Once you create a dynamic control in ASP.NET web page, it is sent to the user with different id and it is processed in the server with a different id.

Although the difference is very small, it makes difference.
For instance, when you create a textbox in code behind file and try to access its ClientID you will see something like the following;
(cAM is the ID of the control)

However, once you would like to catch the Request.Form properties, your textbox will be shown as;


Yes only the separators are different, you need to replace '_' with '$' if you would like to find your control in Request.Form keys.

public string ClientIdFormSearchable(string clientId)
return clientId.Replace('_', '$');


Unknown said…
Better yet, use UniqueID instead of Client ID. This is the correct Id and doesn't require any replacement.
Beck said…
Thank you, this solved my problem (I used the UniqueID property).

Popular posts from this blog

Space Character Problem on IE 6, 7, and 8

Does Netflix work on iOS 5 Beta 4?

AWS encryption chart (SSE-S3 vs SSE-KMS vs SSE-C)