In code-behind of an ASP.NET page I have this method:
public string TestFunc()
{
return "http://www.blabla.net";
}
And in markup this:
<%= TestFunc() %>
If I run the page I see "http://www.blabla.net" as text on the page and in debugger I enter TestFunc - all as expected.
If I put this Hyperlink on the same aspx page...
<asp:HyperLink ID="MyLink" runat="server" NavigateUrl='<%= TestFunc() %>'>Proceed...
</asp:HyperLink>
... I don't enter TestFunc in debugger and the generated HTML of the href contains the embedded code simply as text: href="%3C%=%20TestFunc%28%29%20%%3E"
What am I doing wrong here? I have already tried stupid trial and error: Replaced =
by #
, omitted =
and replaced single quotation marks '
by double quotation marks "
. But all this didn't help. Now I am stumped.
Thanks for help in advance!