I have a web application in asp.net/c# 4.5
I have an href
element on my front-end like below:
<a href="" id="myhref" runat="server"> my text </a>
What I want is to set an href and innerText to the element using c#, but the content will be starting with ~/
So in the code what I do:
myhref.href = "~/default.aspx?id=" + ID;
myhref.InnerText= "~/default.aspx?id=" + ID;
The problem is even though href
looks like "http://localhost:12345/default.aspx?id=10"
and once clicked it navigates the user to the correct page, the inner text on the screen is "~/default.aspx?id=10"
. I need the innerText
to show the complete address on the screen as well. How can I provide it?
Thanks