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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:06:09+00:00 2026-05-18T20:06:09+00:00

I have a databound dropdownlist on a page, where in the page_load I set

  • 0

I have a databound dropdownlist on a page, where in the page_load I set the selectedValue (inside a ‘not isPostBack’).

Although the page displays fine and shows the correct item as selected.. inside the page_load if I try and get the selectedValue() and display it to the screen, I always get null… selectedIndex is -1.

I have a button, which when clicked refers to this ddl’s selectedValue, and here it pulls through the the expected result.. so how come I can’t see it immediately after setting it, while still in page_load?

cheers 🙂

edit: the code..

ddl declaration

<asp:DropDownList runat="server" ID="dlCountryList" DataSourceID="dsCountryList"
                DataValueField="countrylistid" DataTextField="description">
</asp:DropDownList>

and the page_load

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
     dlCountryList.SelectedValue = "GR"
     Response.Write("*" + CStr(dlCountryList.SelectedIndex) + "*")
End Sub
  • 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-18T20:06:10+00:00Added an answer on May 18, 2026 at 8:06 pm

    Manually call the DataBind() method of the drop down after setting the selected value.

    The SelectedValue is not ordinary get/set property of the control, by setting it you only set some “flag” that is used when the drop down is binded.

    By default it’s binded after the Page_Load event (not sure which event exactly) but it’s also possible to call it manually.

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

Sidebar

Related Questions

I have a databound dropdownlist on a page, where in the page_load I set
I have a XAML MenuItem DataBound ItemsSource that is working fine however there is
I have a DropDownList on an ASP.NET page that gets populated by a SQL
This old chestnut again. My page is constructed as follows; I have a dropdownlist
I've got a DropDownList on my page databound to a query from my database
I have a dropdownlist on an ASP.NET web form. It is set to autopostback
I have a CompositeControl that contains a DropDownList. I have set the AutoPostBack property
I have a search.aspx page that has this: <asp:DropDownList id=ddlPopulation runat=server DataTextField=population DataValueField=pid> </asp:DropDownList>
I have the following dropdownlist: <%@ Page Title= Language=C# MasterPageFile=~/myMasterPage.master AutoEventWireup=true CodeFile=testdropdown.aspx.cs Inherits=testdropdown %>
I have an SqlDataSource, a Gridview and a DropDownList on the same page. 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.