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>
You need to bring the databinding tags (
<%#) outside of thePage.ResolveUrlmethod, and use single quotes around thehrefattribute: