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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:58:40+00:00 2026-06-05T14:58:40+00:00

Here is my drop down list and data source. My question is.. when is

  • 0

Here is my drop down list and data source. My question is.. when is it possible to set a defaulted selected option for the drop down list, aka when have all the dropdownlists been databound and their ListItems populated? I have tried Page_PreRender, Page_PreRenderComplete, Page_Load.

I have read over MSDN’s Page Life cycle event which suggest Page_PreRender.

 <asp:DropDownList ID="ddlRampStandard" runat="server"
 DataSourceID="RampStandardDataSource" DataTextField="StandardName" 
 DataValueField="StandardName" RepeatDirection="Horizontal" 
 ViewStateMode="Enabled"></asp:DropDownList>

 <asp:SqlDataSource ID="RampStandardDataSource" runat="server" 
 ConnectionString="<%$ ConnectionStrings:AIMP_DeleteMeConnectionString %>" 
 SelectCommand="SELECT [StandardName] FROM [CR_Standard]"></asp:SqlDataSource>

Here’s the simple code-behind which illustrates what I’m trying to do.

Protected Sub Page_PreRenderComplete(sender As Object, e As System.EventArgs) Handles Me.Load
ddllstSideOfStreet.Items(0).Selected = True
End Sub

I’m getting an instance not created error suggesting ddllstSideOfStreet has no items. I do verify that with a breakpoint and watch that there are no items in existence in any of the previously mentioned prerender, load, prerendercomplte functions.. However when the page loads, the dropdownlist does indeed load with the expected databound information. Thoughts?

  • 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-06-05T14:58:43+00:00Added an answer on June 5, 2026 at 2:58 pm

    just to make sure, have both the handler in the markup and the method using the correct handler in the code behind.

    Like this:

    Protected Sub Page_PreRender(sender As Object, e As System.EventArgs) Handles Me.PreRender
    
    End Sub
    

    And the markup as follows:

    <asp:DropDownList ID="ddlRampStandard" runat="server"     
     DataSourceID="RampStandardDataSource" DataTextField="StandardName"      
     DataValueField="StandardName" RepeatDirection="Horizontal"      
     ViewStateMode="Enabled" OnPreRender="Page_PreRender"></asp:DropDownList>
    

    Tried a similar solution on my machine a moment ago and it worked.

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

Sidebar

Related Questions

i have two dropdown list. first drop down:1 enter code here <form:select path=custName id=custName>
Ok here goes: I have a SELECT drop down option with US state names
I have a drop down list on my web page, the selected item of
I have multiple drop down lists on a page. They all contain list of
I have built a drop-down menu here http://dev.driz.co.uk/jsonmenu/ that uses JSON to dynamically build
Here's the situation I have a webpage which has one drop down called prefer.
I have created a drop down with jQuery that can be seen here by
I have a drop down list on my page & want the list items
I have a drop down list control populated with items and some code to
I have a combo box bound to a Data Source (clientInfoBindingSource) for its selected

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.