Groups | Blog | Home
all groups > asp.net > march 2006 >

asp.net : Hyper Link in DataGrid


aroraamit81 NO[at]SPAM gmail.com
3/2/2006 10:15:32 PM
<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
Ken Cox - Microsoft MVP
3/2/2006 11:05:17 PM
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]


[quoted text, click to view]

aroraamit81 NO[at]SPAM gmail.com
3/2/2006 11:09:56 PM
Thanks Man......
Patrick.O.Ige
3/4/2006 12:09:06 AM
Or you could also do it in the ItemdataBound
Patrick

[quoted text, click to view]

AddThis Social Bookmark Button