Hyper Link in DataGrid

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
 
K

Ken Cox - Microsoft MVP

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

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top