Reputation: 2427
Let's say I have a DropDownList server control, called "CategoriesDDL" and the ClientID proeprty determines its client side id, which is its ID prefixed with the id's NamingContainer's ids. In this case the client side ID is CP1_CategoriesDDL. But what is the rule regarding the client side name, in this case "ct100$CP1_CategoriesDDL"?
Upvotes: 6
Views: 3762
Reputation: 114
Are you using ASP.NET 4? If thats the case, the default for the ClientIDMode property on server controls is "Predictable". If you change that to Auto, you will get same client id and client name except "_"
and "$"
. So on the Server Side, you can use client id, replace "_"
with "$"
to get the client name.
Also look out for the ClientIDMode="Static"
, this will simplify it greatly.
If you are not using ASP.NET 4, seems there is some different reason for your issue.
Upvotes: -1
Reputation: 929
Any chance you're simply after the Control.UniqueId property?
Server side, this will return the client side "name" attribute value of the control.
Upvotes: 13