If I want to manipulate an HTML tag’s properties on the server within an aspx page based on a master page i.e.
<a href='#' runat='server' ID='myLink'>My Link</a>
For example to give the link a different class depending on the current page i.e.
if (Path.GetFileName(Request.PhysicalPath) == 'MyPage') { myLink.Attributes.Add('class','active'); }
.NET changes the ID property of the link to something like
<a href='#' ID='ct100-foo-myLink'>My Link</a>
Is there any way of stopping this from happening and keeping the original ID?
Thanks in advance
AFAIK there is no way.
It shows the actual control tree, which is in this case masterpage-content-control.
However if you add an ID to the masterpage (this.ID = ‘whatever’) then you will see ‘whatever’ instead of ctl00 (which means control index 0).