Soham Krishna
Soham Krishna

Reputation: 65

Server tag not well formed

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?

Upvotes: 1

Views: 60

Answers (1)

User2012384
User2012384

Reputation: 4919

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

Upvotes: 1

Related Questions