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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:44:58+00:00 2026-05-11T07:44:58+00:00

Assume that I have a dropdownlist with 2 items and, by default, the first

  • 0

Assume that I have a dropdownlist with 2 items and, by default, the first item is selected. If I select the click the first item in the dropdownlist, is there a way I can get the SelectedIndexChanged() event to still fire?

I thought I could do it by setting the SelectedIndex of the dropdownlist to -1, but that didn’t work, because it does not display the currently selected value, so it is misleading.

An issue I have on this is that the dropdownlist is used for sorting. I have the sorting semi-working in that if I select the second item, it will sort in ascending order for example, but if I want to sort in descending order now using the second item, I have to select another item and then go back to the second item.

Even if I add a Select By, I think the best solution to sorting is to just have more items in the dropdownlist like:

Sort Numbers (Asc)

Sort Numbers (Desc)

Sort Alphabet (Asc)

Sort Alphabet (Desc)

  • 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. 2026-05-11T07:44:58+00:00Added an answer on May 11, 2026 at 7:44 am

    Note: This is based on the updated content of the question.

    Let’s say you have one drop down list and one listbox (dropdownlist1 and listbox1)

    You can set up your initial drop down list in your page_load event as such:

    dropdownlist1.items.insert(0, '----Select Sort Method----') dropdownlist1.items.insert(1, new ListItem('Alphabetic Ascending', 'AlphaAsc')) dropdownlist1.items.insert(2, new ListItem('Alphabetic Descending', 'AlphaDesc')) dropdownlist1.items.insert(3, new ListItem('Numeric Ascending', 'NumAsc')) dropdownlist1.items.insert(4, new ListItem('Numeric Descending', 'NumDesc')) dropdownlist1.selectedindex = 0 

    Then on your dropdownlist1.selectedindexchanged event you would handle it as such:

    if dropdownlist1.selectedindex <> 0 then    select case dropdownlist1.selectedvalue        case 'AlphaAsc'             Insert Code to Sort ListBox1 Alphabetically in ascending order        case 'AlphaDesc'             Insert Code to sort ListBox1 Alphabetically in descending order        case 'NumAsc'             Insert code to sort ListBox1 Numerically in ascending order        case 'NumDesc'             Insert code to sort ListBox1 Numerically in descending order    end select end if  

    Note: You would want to make sure that your dropdownlist1’s AutoPostBack property is set to true if you want the sorting to happen immediately upon selection of an item.

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

Sidebar

Related Questions

Assume that we have multiple arrays of integers. You can consider each array as
What's the best way to select only those rows from the table that have
Assume that we have an array of small (about 10^(-15) ) double numbers in
Assume that we have N erlang nodes, running same application. I want to share
Assume that you have a running SQL Server Express instance named (local)\SQLEXPRESS. Its database
Assume that I have this piece of code: @interface Foo : NSObject { Bar
Assume that I have the ItemSource bound and i am getting the data. Now
Assume that we have the following code: class Program { static volatile bool flag1;
Assume that I have three class; UserAccount, UserGroup and Role. UserGroup and Role are
Assume that I have two arrays as follow: $array1 = array(1, 3, 5); $array2

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.