Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6618969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:54:22+00:00 2026-05-25T20:54:22+00:00

In an aspx page i have: <asp:HyperLink ID=HyperLink runat=server style=cursor:pointer; text-decoration:none; NavigateUrl='<%#String.Format(~/storefront.aspx?CatalogID={0},Eval(CatalogID))%>’> <asp:Label id=lblCustItem

  • 0

In an aspx page i have:

<asp:HyperLink ID="HyperLink" runat="server" style="cursor:pointer; text-decoration:none;" NavigateUrl='<%#String.Format("~/storefront.aspx?CatalogID={0}",Eval("CatalogID"))%>'>
<asp:Label id="lblCustItem" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CustItem")%>' width="15%">
</asp:Label>
</asp:HyperLink>

And now I am trying to do:

<%if (Eval("Integration").ToString() == "Y")
{ %>
<asp:HyperLink ID="HyperLink1" runat="server" style="cursor:pointer; text-decoration:none;" NavigateUrl='<%#String.Format("~/integration/vendorframe.aspx?CatalogID={0}",Eval("CatalogID"))%>'>
<asp:Label id="CustItemlbl" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CustItem")%>' width="15%">
</asp:Label>
</asp:HyperLink>
<%} %>

<%else
{ %>
<asp:HyperLink ID="HyperLink" runat="server" style="cursor:pointer; text-decoration:none;" NavigateUrl='<%#String.Format("~/storefront.aspx?CatalogID={0}",Eval("CatalogID"))%>'>
<asp:Label id="lblCustItem" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CustItem")%>' width="15%">
</asp:Label>
</asp:HyperLink>
<%} %>

the page errors out on the second segment of code. So my question is, am i doing something wrong, and is there a better way to use an if statement, like the conditional if, but i do need to run a new instance of string.format thats why I was thinking that wasn’t an option.

Error Message:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:54:23+00:00Added an answer on May 25, 2026 at 8:54 pm

    One solution is to use an Inline If:

    Text='<%# (Eval("Integration").ToString() == "Y") ? DataBinder.Eval(Container.DataItem, "CustItem") : "" %>'
    

    It’s not pretty, but it’ll get the job done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On an aspx page I have following hyperlink: <asp:HyperLink ID=HyperLink1 runat=server NavigateUrl=#Bottom CssClass=ToBottom>To Bottom
I have a asp.net repeater control in a aspx page, with runat=server and an
I have a Repeater control in my aspx page: <asp:Repeater ID=repeater runat=server EnableViewState=false> <ItemTemplate>
i have a web page wit Repeater <asp:Repeater ID=Repeater1 runat=server> <HeaderTemplate> <th bgcolor=#666666 style=color:
Let's say I have a repeater with the code: <ItemTemplate> <asp:HyperLink ID=HyperLink1 runat=server NavigateUrl='<%#DataBinder.Eval(Container.DataItem,
I am having an aspx page where I have added one asp.net text box
I have Update panel in Master page: <asp:ScriptManager id=CartScript runat=server></asp:ScriptManager> <asp:UpdatePanel id=CartBox runat=server updateMode=Conditional>
I have an ASP.NET page with code-behind in VB.NET. On the ASPX page I
I have a C#/ASP.NET .aspx page that declares two controls that each represents the
I have inherited an asp.net website to maintain when looking at the aspx page,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.