I'm looking at adding master pages to an existing site but have found that once I do, the elements' IDs get prepended with a code (e.g. ctl00_MainPageContent_
).
Unforunately, this breaks existing scripts on the page that use the original, unmodified element ID.
I realize that I can replace it with <%= Element.ClientID %>
but it'd be awesome if I could disable this behavior altogether.
So, can I keep the original IDs?
The question was already answered in the previous post: Remove MasterPage Generated ID
The solution overrides the Render Event with the following code:
You can override ClientID and UniqueID in the controls. This is from here, an article by Rick Strahl.