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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:49:05+00:00 2026-05-27T11:49:05+00:00

Every time I click an ASP button on my page to select an item

  • 0

Every time I click an ASP button on my page to select an item in my dropdown list, it is only choosing the first item in the list. It is as if every time I click a button the page refreshes and all variables reset. How do you choose an item from a dropdown when using dynamic data from a database?

  • 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-27T11:49:06+00:00Added an answer on May 27, 2026 at 11:49 am

    This sounds indicative of populating the DropDownList in Page_Load. Is that the case? (I’m assuming you’re using WebForms.) If you’re populating the control in Page_Load then you’ll want to wrap it in a conditional:

    if (!IsPostBack)
    {
      // populate your controls from data
    }
    

    Otherwise, they’ll get re-populated with each postback. When you click a button or perform some other action on the page which initiates a postback, Page_Load is called before the event handler. So in effect, this is happening:

    1. User navigates to the page
    2. Page_Load clears and re-populates the DropDownList
    3. User chooses an item in the DropDownList
    4. User clicks a button
    5. Page_Load clears and re-populates the DropDownList
    6. Button handler gets the current selection from the DropDownList, which is the default.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When clicking the button for first time change button text, on 2nd click redirects
We have an issue on our page whereby the first time a button posts
I have a RichTextBox that I write a string to every time I click
I'm using a form to display XML elements. Every time I click on a
Every time a user clicks on a link in a list view unordered list,
I want to have a clock showing current time and refreshes every second. The
I'm trying to use an update panel so my page doesn't refresh every time
I have asp button, which functionality is for deleting the item. Button is inside
Every time i reset & seed my database it wipes out the standard admin@example.com
Every time when I'm trying to load the .dll in my application, I'm getting

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.