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 592659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:45:46+00:00 2026-05-13T15:45:46+00:00

Within a repeater control, is there a way of de-binding certain items before the

  • 0

Within a repeater control, is there a way of de-binding certain items before the page is rendered?

Currently we have a collection of items being bound to a repeater and if the item is not part of the current language, we hide the item.

I’m wanting to be able to do a count on the repeater and get a valid number back. A count that doesn’t also include the hidden items.

Is it possible to de-bind specific items perhaps in the ItemDataBound event?

Update

For each item in the collection we’re binding, we check the database during the ItemDataBound for further information about the item, such as language etc. This is currently stopping us from filtering the bound data before binding it.

  • 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-13T15:45:46+00:00Added an answer on May 13, 2026 at 3:45 pm

    I agree with the others answers – the best solution (for both performance and code clarity) is to redesign the page so that you can filter invalid entries out before databinding.

    Most data sources don’t allow us to remove their items while ASP.NET is iterating them. For example, if you bind to a simple generic List<T>, and you remove an item while iterating it, the list will throw an InvalidOperationException.

    In other cases, ASP.NET actually iterates a a copy of the data source. If you bind to a DataTable, ASP.NET uses a copy of the contents (the default DataView) rather than iterating the source rows themselves – you can remove items from the underlying data source while iterating, but it doesn’t affect the databinding operation.

    If filtering the items in advance really isn’t an option, your current solution is fine: just hide the items! If you need to get the correct count on top of that, track the number of invalid items in your ItemDataBound handler and expose it as a page-level property:

    if (IsInvalid(args.Item.DataItem)) {
        this.invalidItemCount++;
        // code to hide the current item
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET page that uses a repeater nested within another repeater to
I have a gridview control nested within a repeater control. The repeater control is
I use asp.net and c#4. I have a repeater within inside a HyperLink Control.
I have the following Image control within a repeater. I'm trying to get the
Is there a way to group content within a Repeater with a dynamic heading?
I have a page on my ASP.NET site that has a Repeater control to
I have a repeater control: <table style=width: 100%> <asp:Repeater runat=server ID=rptOptions OnItemDataBound=rptOptions_ItemDataBound> <HeaderTemplate> <tr>
I have buttons contained within a repeater. A ModalPopupExtender is used to confirm event
Ok, I have a hyperlink on my page and that hyperlink is held within
I have a repeater which binds a set of data. Within this repeater is

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.