views:

134

answers:

1

I need to include multiple Eval fields in the Navigate URL field of a hyperlink control, however, the code I have tried does not work.

<asp:HyperLink ID="hlkImageLink" runat="server" NavigateUrl='<%# Eval("getProductIDGV","getProductCategoryNameGV","getProductCategoryIDGV", "~/PT_productdetails.aspx?ProductID={0}&amp;CategoryName={1}&amp;CategoryID={2}") %>'>
+5  A: 

Try:

NavigateUrl= '<%# String.Format("~/PT_productdetails.aspx?ProductID={0}&CategoryName={1}&CategoryID={2}", HttpUtility.UrlEncode(Eval("getProductIDGV")), HttpUtility.UrlEncode(Eval("getProductCategoryNameGV")), HttpUtility.UrlEncode(Eval("getProductCategoryIDGV"))) %>'
thedugas
Thanks but getting the error: Reference to a non-shared member requires an object reference.
burntsugar
@burntsugar - Sorry. I changed the UrlEncode to be called from HttpUtility - it was not a static (shared) method of HttpServerUtility.
thedugas
Your a champ. THANKS! :)
burntsugar