Reputation: 610
I tried this one but the href code is not generated
<asp:HyperLink ID="hlPrev" NavigateUrl="<%# this.Request.Url %>" runat="server" />
Is there any way to do this on aspx page not in the code behind?
Upvotes: 1
Views: 1233
Reputation: 62290
If hlPrev is located outside of DataBound controls like GridView, there are two problems in our code -
<%= %>
instead of <%# %>
which is used in DataBound controls.<%= %>
to set property of a server control. Basically, you cannot mix runat="server"
with <%= %>
.<a href="<%= Request.Url.ToString() %>">Click Me</a>
Upvotes: 4