This is an error I get in my asp.net page when I want to bing my repeater to datasource. I have a hyperlink component in my page, look at the below code:

 <asp:HyperLink ID="HyperLink2" runat="server" Text="Details..." NavigateUrl='<%# "product_details.aspx?id=" + Eval("ID") %>'></asp:HyperLink>

I get this error because the type of "ID" field is numeric, so ASP.NET can not concat it with string value, I change the code and it works!

<asp:HyperLink ID="HyperLink2" runat="server" Text="Details..." NavigateUrl='<%# "product_details.aspx?id=" + cstr(Eval("ID")) %>'></asp:HyperLink>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5