Reputation: 1567
The URL in the databound object contains something like "~/root/path/test.aspx?id=1".
(code below). I want to do Page.ResolveUrl
on it inside the ListView
. Just can't get the syntax right. Can anyone help please?
<asp:ListView ID="DataLV" runat="server">
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
</LayoutTemplate>
<ItemTemplate>
<a runat="server" href="Page.ResolveUrl(<%#Eval("URL")%>)">View full data</a>
</ItemTemplate>
</asp:ListView>
Upvotes: 0
Views: 1637
Reputation: 46067
You need to bring the databinding tags (<%#
) outside of the Page.ResolveUrl
method, and use single quotes around the href
attribute:
href='<%#Page.ResolveUrl(Eval("URL"))%>'
Upvotes: 1