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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:05:49+00:00 2026-05-11T05:05:49+00:00

I would like suggestions on how to inject a record into my DropdownList to

  • 0

I would like suggestions on how to inject a record into my DropdownList to give an ‘All’ option. Here is my code, data coming from the Northwind database.

<asp:DropDownList ID='ddlRegion' runat='server' DataSourceID='SqlDataSource1'      DataTextField='RegionDescription' DataValueField='RegionID'          AutoPostBack='True' onselectedindexchanged='ddlRegion_SelectedIndexChanged' /> <asp:SqlDataSource ID='SqlDataSource1' runat='server'      ConnectionString='<%$ ConnectionStrings:NorthwindConnectionString %>'      SelectCommand='SELECT [RegionID], [RegionDescription] FROM [Region]'          ondatabinding='SqlDataSource1_Databinding'> </asp:SqlDataSource> 

I have tried the following but it does not add the item;

if(!Page.IsPostBack()) ddlRegion.Items.Insert(0, new ListItem('All', '-1')); 

I am thinking perhaps using the ondatabinding might be the right way to go but am not sure how to go about it.

Thanks

  • 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. 2026-05-11T05:05:49+00:00Added an answer on May 11, 2026 at 5:05 am

    Just add the All item in the ASPX, and then set AppendDataBoundItems=true and it will keep the statically defined items with the data bound items.

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

Sidebar

Related Questions

I would like suggestions on how to inject a record into my DataList to
I need some asp.net pagination code samples. I would like suggestions on open source
I have looked into both. Would like your suggestions as to which one is
I would like to receive suggestions on the data generators that are available, for
I would like your suggestions on how to proceed in making a control panel
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode
I have a specific case here in which I would like some security advice.
I would like to make a vb .net application that auto logs into places
I'd like to use a tooltip as a toolbar and would like some suggestions
I would like to have suggestions as to how to use Qt to implement

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.