I am trying to use Web.Router and I am trying to set it in a hyperlink where some variables need to be binded from a dataTable. Also, this link is a part of a Gridview:-
<a href='<asp:Literal runat="server" Text="<%# String.Format("$RouteUrl:id={0},title={1}", Eval("ID"), Eval("title") %>" />' target="_blank" style="color:#330000; font-size:18px; font-weight:bold"><%# Eval("title")) %></a>
But I get error: Server Tag not well formed. What's wrong with the syntax?
Try changing
<a href='<asp:Literal runat="server" Text="<%# String.Format("$RouteUrl:id={0},title={1}", Eval("ID"), Eval("title") %>" />' target="_blank" style="color:#330000; font-size:18px; font-weight:bold"><%# Eval("title")) %></a>
To this
<a href='<asp:Literal runat="server" Text='<%# String.Format("$RouteUrl:id={0},title={1}", Eval("ID"), Eval("title") %>" />' target="_blank" style="color:#330000; font-size:18px; font-weight:bold"><%# Eval("title")) %></a>
You put a double quot instead of single quot
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.