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.
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)
ctl00_ctl00_BodyStyle_MainContent_DisplayWindow_ctl00_ctl02_cAM
However, once you would like to catch the Request.Form properties, your textbox will be shown as;
ctl00$ctl00$BodyStyle$MainContent$DisplayWindow$ctl00$ctl02$cAM
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('_', '$');
}
Comments