Reputation: 173
I'm trying to do this simple task using this kind of coding (ASP.NET Inline expression):
Where:
Vars is a static class that contains static strings variables.
Code:
<asp:HyperLink ID="anyHyperLink" runat="server" />
<% anyHyperLink.NavigateUrl = Vars.aDirectoryString; anyHyperLink.Text = "Some Text"; %>
The output markup ends showing that the inline expression code has no effect!
Thanks..
Upvotes: 2
Views: 391
Reputation: 40413
You have to put that line above the control, not below it. The engine reads top to bottom, so by the time it gets to your code, the HTML has already been rendered for the link.
Or you can put it in the code-behind in Page_Load
or something like that, instead of the markup.
Upvotes: 2