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

  • SEARCH
  • Home
  • 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 4271364
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:25:55+00:00 2026-05-21T07:25:55+00:00

I used repeater in asp.net. My problem is don’t know how to hide a

  • 0

I used repeater in asp.net. My problem is don’t know how to hide a fields in repeater. There is a regular price and now price if regular price is equal to zero it will hide the fields and if not it will show the value of the regular price. i hope you can help on this.

here my code in asp:

 <a href="<%=Utility.GetSiteRoot() %>/BookInfo.aspx?SKU=<%# Utility.SKUMask(Eval("lb_sku").ToString()) %>">
               <img width="150px" src='<%# Eval("lb_picturepath")%>'>
             </td>
             <td valign="top">
             <asp:Label ID="lb_titleLabel" runat="server" CssClass="center-head" Text='<%# Eval("lb_title") %>' />
             <p><asp:Label ID="lb_descriptionLabel" runat="server" Text='<%# Eval("lb_description") %>' /></p>
             <div class="price"><%# "Price: " +  decimal.Round((decimal)Eval("lb_sellingprice"),2)%></div>
             </td>
             </tr>
             <tr>
             <td></td>
             <td>
              <a class="addtocart" href="<%=Utility.GetSiteRoot() %>/AddToCart.aspx?SKU=<%# Utility.SKUMask(Eval("lb_sku").ToString()) %>" >Add To Cart</a>
              <a href="<%=Utility.GetSiteRoot() %>/BookInfo.aspx?SKU=<%# Utility.SKUMask(Eval("lb_sku").ToString()) %>"  class="readmore">
              View Details
             </a></td>   

thanks!

  • 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-21T07:25:56+00:00Added an answer on May 21, 2026 at 7:25 am

    You would need to handle the OnItemDataBound event, and then change the visibility of the control. An example of this is shown below:

    ASPX Page

    <asp:Repeater ID="MyRepeater" OnItemDataBound="MyRepeater_OnItemDataBound" runat="server">
    <ItemTemplate>
        <asp:Label ID="RegularPriceLabel" runat="server" />
        <br/>
        <asp:Label ID="BuyNowPriceLabel" runat="server" />
    </ItemTemplate>
    </asp:Repeater>
    

    Code Behind

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            MyRepeater.DataSource = GetDataSource();
            MyRepeater.DataBind(); 
        }
    }
    
    protected void MyRepeater_OnItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
       {
            // This will be your data object
            MyEntity o = (MyEntity) e.Item.DataItem;
    
            // Get the labels
            Label RegularPriceLabel = (Label) e.Item.FindControl("RegularPriceLabel");
            Label BuyNowPriceLabel = (Label) e.Item.FindControl("BuyNowPriceLabel");
    
            // Only show regular price if it is set
            RegularPriceLabel.Visible = (o.RegularPrice > 0);
    
            // Populate labels
            RegularPriceLabel.Text = o.RegularPrice.ToString();
            BuyNowPriceLabel.Text = o.BuyNowPrice.ToString();
    
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am used to using a Repeater control in conventional ASP.Net web projects. I
I know that the asp.net repeater doesnt have a Client side object model, and
In my asp.net website I am using nested repeaters.Outer repeater is used to display
I'm using repeater control from asp.net for data binding. And for designing i used
I am a PHP developer but now I am learning asp.net with C# as
I have a ASP.NET 3.5 page which has a repeater containing lines of information
I have come across the ASP.NET ready made controls like grid, repeater... etc. For
I am using Repeater in asp.net, i want to display total number of records.
I have a designed landing page in asp.net 4.0 i am using repeater control
I am analyzing a problem from an old asp.net site made by one of

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.