If I have a TABLE or a DROPDOWNLIST, with an ID="Test", in a Page Default.aspx, contained in a Master Page, these controllers change their ID’s to "MainContent_Test", means any CSS attributed to #Test won’t work, and I feel that I’m having problems in C# as well, why does this happen? and How can I prevent it?
If I have a TABLE or a DROPDOWNLIST , with an ID=Test , in
Share
ASP.NET adds name of control containers to generated client ID. But if you use .NET 4.0 or later you can use cotntrol’s
ClientIdModeproperty:http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientidmode(v=vs.100).aspx
Just set it to
Staticand the ID will not change.Other options may include defining style via class and not attaching it to specific control ID.