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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:33:48+00:00 2026-05-26T04:33:48+00:00

I have a DropDownList that is filled with values returned by a SQL Query.

  • 0

I have a DropDownList that is filled with values returned by a SQL Query. After the list is filled, I add two options manually to this DropDown: -- Select -- and ALL.

When the page loads, the DropDownList shows -- Select -- as the default value. When the user opens the DropDownList, the SQL Query returned list opens along with ALL option also.

I want to make this ALL appear as the fist item in the list when the list opens. I can’t used: DropDownList.SelectedIndex because I want have already made -- Select -- as the selected index.

How to make ALL the first option when the list opens?

  • 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-26T04:33:49+00:00Added an answer on May 26, 2026 at 4:33 am

    As much as I understand your dream is to have a dropdownlist like this

    SELECT(this one comes as selected)
    ALL(the first item in the dropdownlist)    
    V1(from your query)
    V2(from your query)
    V3(from your query)
    ..
    .   
    

    You can do this

    string selectStr = "SELECT";
    string allStr = "ALL"
    
    ListItem allLI = new ListItem(allStr,allStr);        
    ListItem selectLI = new ListItem(selectStr,selectStr);
    
    DropDownList.Items.Add(selectLI);
    DropDownList.Items.Add(allLI);
    
    
    //code to fill the DropDownList with the list that your query returns
    
    DropDownList.SelectedValue = selectStr;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a dropdownlist that populates from the sql server database. populating the list
I have the following code that sets a cookie: string locale = ((DropDownList)this.LoginUser.FindControl(locale)).SelectedValue; HttpCookie
I am having problems with postbacks. I have a dropdownlist that i add items
I have a DropdownList that shows a list of providers & the Provider associated
I have a dropdownlist to fill in server-side an some of the options that
I have a DropDownList that is populated from a datasource. After it is bound,
I have DropDownList, which has some options to choose from. Now after when user
I have an ASP.NET dropdownlist called #ddlDateRange that contains several items. Possible values in
I have a dropdownlist that I already have manually databinding. I currently get the
I have a dropdownlist that has 4 columns but only 3 are 'visible' the

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.