How can I dynamically set a stand alone(not in gridview) hyperlink control’s NavigateUrl property inline in the aspx page?
I have tried to do the following, but it did not work.
<asp:HyperLink id="MyLink"
NavigateUrl="../mypage.aspx?id=<%= pageid %>"
runat="server">My Page</asp:HyperLink>
You could do this in the codebehind:
UPDATE:
Now that @Marko Ivanovski pointed me in the comments that this hyperlink is inside a
GridViewwhich I didn’t notice in the beginning the easiest would be to use databinding (<%#syntax):In this case
pageidis a property of the data source.UPDATE 2:
Do you really need a server side control? How about: