User Control Root

W

Willem

This is making me mental: For some reason I can't get the virtual
application root directly in a control.
This doesn't work:
<asp:HyperLink ID="HyperLink1" Target="_parent" NavigateUrl="~/
page.aspx" runat="server">click here</asp:HyperLink>

it gives http://www.contoso.com/page.aspx
While it should give http://www.contoso.com/MyApplication/page.aspx

Now when I set the navigateURL in de Page_Load of the control, like
below, it does work:
HyperLink1.NavigateUrl = ResolveUrl("~/page.aspx");
gives: http://www.contoso.com/MyApplication/page.aspx

Now, I have about 30 controls with countless images. Is there an
easier way to get the virtual application root, then setting it all
individually in the Page_Load Event?

thanks in advance,
Willem
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top