Reputation: 87
I'm trying to bind an ID to an already defined navigation url from a hyperlink.
<asp:HyperLink ID="HyperLink4" runat="server"
NavigateUrl='accounts_history.aspx?accountId=<%# DataBinder.Eval(Container.DataItem, "Id") %>'>Historiek</asp:HyperLink>
This is my hyperlink. The <%# DataBinder.Eval(Container.DataItem, "Id") %>
part works but using this method the hyperlink just sees it as clear text, resulting in the following link:
accounts_history.aspx?accountId=<%# DataBinder.Eval(Container.DataItem, "Id") %>
What is causing this?
Upvotes: 0
Views: 677
Reputation: 1117
Try this
NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "Id", "accounts_history.aspx?accountId={0}") %>'
http://msdn.microsoft.com/en-us/library/2d76z3ck.aspx
You should place only databinding expression in property.
Upvotes: 1