I have a user control which is hosted in a content placeholder.
This is just 1 scenario, but the user control gets used all over the site.
The user control is responsible for generating a JSON request, and to my horror I’m noticing that the form element id’s / names aren’t what I’ve called them – instead prefixed by controlID_ContentPlaceHolderID_UserControl_MyActualFormElementName
I know I can turn this off if I was using .net v4, but the project is v2.
Please can you tell me how to grab the control path in the code behind, and by this I mean dynamically determine the ctl00_ContentPlaceHolder_UserControlID part.
I could then create another form element -> post through the name -> and then server side after the post, know what my form elements are.
Thanks in advance.
from the top of my head, without testing, for the given user control recursively find the first control in the parent chain, during the return trip, buildup the ‘path’ for every ClientId;