I am trying to instantiate a user control programmatically in the code menu of a website *. The only ways I found the link to the user control class were:
- Register the control in the web.config file and delete the control on the page (it works, but I do not want the control on the page as I want to dynamically add it).
- Add the link <% @Reference Control = "Name.aspx"> to the aspx page at the top.
Ideally, I would like to have a link to an aspx page for the link without placing the <% @Reference> ad at the top of each page. I know that I can "register" controls in the web.config file, so I donβt need to do this on every page, so I wonder if something like this exists for links. I am pretty sure that I have something missing in the whole concept of registration / link, so maybe just an explanation that the best way to do this is ok.
* A project such as a website, not a web application, if that matters.
source share