Hyper Link in DataGrid

  • Thread starter Thread starter aroraamit81
  • Start date Start date
A

aroraamit81

<ItemTemplate>
<asp:HyperLink CssClass="LinkShort" Runat="server"
NavigateUrl="TeamUsers.aspx?TeamID=<%#((System.Data.DataRowView)Container.DataItem)["Team_Name"]
%>">
<%#((System.Data.DataRowView)Container.DataItem)["Team_Name"]
%>

</asp:HyperLink>

</ItemTemplate>

What is wrong with the above statements. I gives me a parser error like
"The server tag is not well formed."

Any Help?????

Regards,

Amit Arora
 
You need to use single quotes on the outer attribute value because you have
double quotes in the server-side code. Try this?

<asp:templatecolumn>
<itemtemplate>
<asp:hyperlink
id="HyperLink1"
runat="server" cssclass="LinkShort"
navigateurl='TeamUsers.aspx?TeamID=<%#((System.Data.DataRowView)Container.DataItem)["Team_Name"]
%>'>
<%#((System.Data.DataRowView)Container.DataItem)["Team_Name"] %>
</asp:hyperlink></itemtemplate>
</asp:templatecolumn>

Ken
Microsoft MVP [ASP.NET]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top