How do I use asp:hyperlink with databinding
I thought I had this one pretty good, but I just keep running into an error
Am I doing anything wrong in the code that you can see?
<asp:HyperLink ID="HyperLink1" runat="server" 开发者_运维知识库NavigateUrl='<%# String.Format(~/storefront.aspx?CatalogID={0}&ProductID={1}",DataBinder.Eval(Container.DataItem, "CatalogID"),DataBinder.Eval(Container.DataItem,"CustItem")) %>' >
Is there another method I could use any help on the matter is appreciated. Thank you
You're missing an open quote in the String.Format function. Try this instead:
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#String.Format("~/storefront.aspx?CatalogID={0}&ProductID={1}", Eval("CatalogID"), Eval("CustItem"))%>'></asp:HyperLink>
精彩评论