asp.net - hyperlink.NavigateUrl getting changed on master page (possibly by ResolveUrl() ) -
i have hyperlink in cases want change show jquery popup, i'm having strange problem when doing on master page. following works in regular page:
hyp1.navigateurl = "#notificationpopup"; which renders as:
<a id="ctl00_hyp1" href="#notificationpopup">example</a> this want. problem exact same code on hyperlink on master page renders as:
<a id="ctl00_hyp1" href="../masterpages/#notificationpopup">example</a> it looks might running navigateurl through resolveclienturl() or when i'm setting on master page. i've tried swapping <asp:hyperlink <a href runat=server, same thing happens.
any ideas?
there note on msdn control.resolveclienturl method description.
the url returned method relative folder containing source file in control instantiated. controls inherit property, such usercontrol , masterpage, return qualified url relative control.
so behavior of master page in exampe predictable (although not comfortable work with). alternatives?
the best 1 set <a> client control (remove runat="server"); should work charm in master page:
<a href="#notificationpopup">example</a> in case if control should server side only: build url code behind using uribuilder class:
uribuilder newpath = new uribuilder(request.url); // add #notificationpopup fragment current url newpath.fragment = "notificationpopup"; hyp1.href = newpath.uri.tostring();
Comments
Post a Comment