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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:31:47+00:00 2026-05-11T17:31:47+00:00

I have two DropDownListBoxes one is called ddlDay and the other is ddlMonth. As

  • 0

I have two DropDownListBoxes one is called ddlDay and the other is ddlMonth. As their names suggests, ddlDay has values from 01 to 31 (not dynamic) and ddlMonth has values from 01 to 12. These values are not dynamically set.

When the page loads, I am getting values from the db.. depending on the value, I am using ddlDay.SelectedItem.Value = the value from the db to set the value and make the item selected.

The code I provide below was tested with If Not Page.IsPostback Then... statement without any luck.

however, when the page is loaded for the first time, nothing happens. but if I refresh the page and therefore cause a postback, then the values get binded correctly.

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        loadInterview()
    End Sub

Private Sub loadInterview()
    If Request.QueryString("iID") = "" Or Request.QueryString("iID") Is Nothing Then
        Response.Redirect("interviews_list.aspx")
    Else
        Dim int As New hh.Interviews
        int = hh.Interviews.ReturnSingleInterview(Request.QueryString("iID"))

        ddlDay.SelectedItem.Value = int.InterviewDate.Day.ToString("00")
        ddlMonth.SelectedItem.Value = int.InterviewDate.Month.ToString("00")
        txtYear.Text = int.InterviewDate.Year

        txtPerson.Text = int.InterviewPerson
        txtTitle.Text = int.InterviewTitle
        txtText.Text = int.InterviewText

    End If
  • 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-11T17:31:48+00:00Added an answer on May 11, 2026 at 5:31 pm

    Try this to set initial values :

    ddlDay.ClearSelection()
    ddlDay.Items.FindByValue(int.InterviewDate.Day.ToString("00")).Selected = True
    
    ddlMonth.ClearSelection()
    ddlMonth.Items.FindByValue(int.InterviewDate.Month.ToString("00")).Selected = True
    

    NOTE : ClearSelection method avoids the HttpException exception with ‘Cannot have multiple items selected in a DropDownList.’ message.

    EDIT 2 : Suppose you have this dropdown list :

    <asp:DropDownList ID="ddlItems" runat="server">
        <asp:ListItem Text="Item 1" Value="Item 1"></asp:ListItem>
        <asp:ListItem Text="Item 2" Value="Item 2" Selected="true"></asp:ListItem>
        <asp:ListItem Text="Item 3" Value="Item 3"></asp:ListItem>
    </asp:DropDownList>
    

    If you set “Item 1” to your ddlItems.SelectedItem.Value like that :

    ddlItems.SelectedItem.Value = "Item 1"
    

    Your dropDown list becomes like that :

    <asp:DropDownList ID="ddlItems" runat="server">
        <asp:ListItem Text="Item 1" Value="Item 1"></asp:ListItem>
        <asp:ListItem Text="Item 2" Value="Item 1" Selected="true"></asp:ListItem>
        <asp:ListItem Text="Item 3" Value="Item 3"></asp:ListItem>
    </asp:DropDownList>
    

    I mean ddlItems.SelectedItem refers to your dropdown’s selected item.

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

Sidebar

Related Questions

I have two tables. One is Employee_Mstr and other is EmployeeLeaveRequest_mstr . My data:
Have two sets of data (two tables) for patient records, one 1999-2003, the other
I have two models, one called Notes and one called Comments. Comments can be
I have two databases named: DB_A and DB_B . Each database has one collection
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two XML files. The first XML has a bunch of nodes that
I have two tables inside a database. One stores unique userNames and a unique
I have two function, one function is a reload function that does a ajax
Have two events: $('body').mouseup(function(e){} and $('.toggle').click(function(e){} I only want one of these to trigger.
I have two structs (part of the assignment). A list of one -- Activity,

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.