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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:53:02+00:00 2026-06-01T00:53:02+00:00

I am stuck with a simple problem but not able to figure out the

  • 0

I am stuck with a simple problem but not able to figure out the solution
I have an asp.net application that queries some data from data reader based on filters and updates in a listbox when Done button is pressed. The problem is that if i modify the selection and press Done again, the old values are still present i.e. I get old results and the new ones are appended. How do remove the old values so that everytime I modify my selection I get only the new values.

  • 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-06-01T00:53:03+00:00Added an answer on June 1, 2026 at 12:53 am

    First, if you’re loading the values in Page_Load, be sure to surround your loading code with an if(!Page.IsPostback) statement to ensure you’re not re-binding it on every load. (See the ASP.NET Page Lifecycle for details.)

    if(!Page.IsPostback)
    {
       // Binding code goes here.
    }
    

    (Alternatively, you can bind it on every page load in Page_Init instead of Page_Load, which will allow you to bind it and have the user-entries be applied when the Viewstate is applied. Again, see the Page Lifecycle for details. Or this great article.)

    Next, ensure that you are calling the Clear() command on the listbox to remove items.

    MyListBox.Items.Clear()

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

Sidebar

Related Questions

I'm stuck on a RegEx problem that's seemingly very simple and yet I can't
I am stuck with something quite simple but really annoying: I have an xml
I feel that it should be something very simple and obvious but just stuck
I have seen other thread with similar issue but was not able to work
I'm not very good at C, and I always get stuck on simple string
I'm stuck in having to write a simple spam filter I'm not really sure
A little stuck here. I have a simple question I guess. Given the following
This is probably a simple one to answer, but I'm stuck, so here goes.
I am trying to figure out how to create an optimal solution for my
I am stuck with a simple regex problem. What I want to do 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.