Hyperlinks in User Controls (1.1)

M

MattB

I'm migrating code that used to be repeated on several pages to a single
user control. In this control there is a repeater, and when the repeater
is bound, I add some links to it. This all worked great on the page but
now that I have moved the code to a user control (which lives in a
subdirectory in my application: /UserControls), my links which are all
generated as relative links now add that sub directory to the path. So
I'd like a link to point to www.mysite.com/mypage.aspx, but after moving
the code to a control, it now generates as:
www.mysite.com/UserControls/mypage.aspx.
I know I could just do some string manipulation to fix this but I'm
wondering if there is a more elegant way to fix this right. Like a way
to tell the control to generate the relative link correctly even if the
UserControl folder name changed or regardless of whether the application
is running in the root of IIS or within a Virtual directory.
Any ideas? Thanks!

Matt
 
M

Munna

Hi,

Hi if previously you links address like <a herf="somepage.aspx">Link</
a>
now change it to <a herf="../somepage.aspx">...

Best of luck

Munna
 

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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top