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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:42:02+00:00 2026-05-12T05:42:02+00:00

I have a dropdownlist that is being populated from a database. That is working

  • 0

I have a dropdownlist that is being populated from a database. That is working fine. The nonselectvalue of the control is -1 and the nonselectlabel is “..”. When I try to open an existing record for editing, I can’t seem to select the correct row. There are three parts to the ID: 111A-DD-12345. When the record is returned from the database, the ID is parsed into the three fields. The first and third parts are textboxes on the page, but the middle part is a dropdownlist. When we open an existing record, we parse out the ID with the following code:

string[] chunks = cID.Split('-');
ddOffice.SelectedItem.Text = chunks[1];

But this just changes the first row of the ddl to DD (using the example ID above), so we end up with two rows in the ddl that have the same displayed text. How do I programmatically set the dropdownlist to the correct value?

Edit: We also tried
ddOffice.SelectedValue = chunks[1]
, but that just displays the .. of the default, non-selected row.

TIA,
Theresa

  • 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-12T05:42:03+00:00Added an answer on May 12, 2026 at 5:42 am

    Try this:

    ddOffice.SelectedIndex = ddOffice.Items.IndexOf(ddOffice.Items.FindByText(chunks[1]));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 276k
  • Answers 276k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You must create the new instance of the google map… May 13, 2026 at 2:50 pm
  • Editorial Team
    Editorial Team added an answer Did you create an object in your test code where… May 13, 2026 at 2:50 pm
  • Editorial Team
    Editorial Team added an answer An HTTP POST can be bookmarked, but since a bookmark… May 13, 2026 at 2:50 pm

Related Questions

I have a drop down list that is being used in an EditItemTemplate of
I have an ASP SqlDataSource connected to Sybase DB query, using Select Parameters that
I've got a page which will have about ten drop down lists which are
I'm getting XSS errors when trying to consume a .NET web service and I'm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.