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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:47:42+00:00 2026-06-03T05:47:42+00:00

I have a list of values in a SQL Table which are used to

  • 0

I have a list of values in a SQL Table which are used to popluate a DropDownList, having a unique Integer as the value of each item and a String as the visible text (via SqlDataSource). There is also a third field in the database which is a flag to indicate whether the list item is active or not (inactive items are not shown in the DropDownList)

Selections made in the dropdown are stored in the database as their integer value (as part of a dataset making up the overall record), not the text value.

Over time, the items in the DropDownList may be removed by marking the items as inactive. However, there is still a need to open old records which may have had a now-inactive item as part of it’s data…

My question is, what’s the best way to ensure that the missing value included in the dropdown for the old record?

The two methods that spring to mind are to either:

Populate DropDownList with only the currently active items and, when loading a record, catch when the app tries to select a value that doesn’t exist, go back to the db to see what it should be (the text value) and manually add it into the dropdown.

or…

Populate DropDownList with all list items (both active and inactive), load the record and then programatically remove all the inactive items (execpt for any that are now selected).

Neither of these seem particularly efficient, so I was wondering whether there is a best practice for this kind of thing?

  • 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-03T05:47:43+00:00Added an answer on June 3, 2026 at 5:47 am

    there are so many optimum ways to do that sort of things, i am defining here a couple of them, use any of following if your Drop down list items count is less than 200 , lets say drop down list is of Products

    1)

          i) Load all Products records in drop down list and hide the inactive ones by setting visible=false

          i) When you load a user record than look for its drop down list value if its visible than select it and enjoy, if its not visible than make it visible by setting its property visible=true and select it and also set its index or id in a flag to change its visibility(visible=false) again after your/users required operation performed.

    2)

          i) load only active Product records in drop down list
          ii) while loading a user record also load its product details(name, id, inactive_status) using Joins in sql.

          iii) check in that user record if item is inactive then add its record in drop down list as you have all its details now with user details record else just select it.

    IMPORTANT NOTE: if you drop down list has items in millions than use ADVANCE SEARCH techniques

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

Sidebar

Related Questions

Suppose I have a list box with different items, each with unique values, and
I have a method insert() which inserts a list of values into a table
I have a List with array of object values. I have to display value
I have a select list which is being populated using the values from a
SQL Server 2000 I have a table which lists out the months where a
I have a table which has data from a graph. for example index value
I want a sql query which serves to return a list of values of
I have this managed bean which takes two values from database's table import java.io.Serializable;
I have a SQL query which selects some values (and works across tables in
I have a list of values, and want to know which ones don't already

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.