Add static item to DropDownList web control after data bind in ASP.NET

Add static item to DropDownList web control after data bind in ASP.NET

Sometimes we need to add a static item to the top of DropDownList web control, such as “– Please select –” or any other text. This static item will be removed and replaced with the items that comes from the data source you are using after calling DataBind() method. 

To keep the static item you are going to need to set the “AppendDataBoundItems” property of the DropDownList to “True”.

This will keep all your static items and instead of remove and replace the items that comes from the data source you are using it will append to the existing items in the DropDownList.

Share this post

Comments (9)

  • Anonymous Reply

    gededa de thanks ya bahsa

    October 25, 2007 at 4:29 PM
  • Anonymous Reply

    Thnx man..!!!

    October 28, 2007 at 9:13 AM
  • Unknown Reply

    thanks dude. You’ve saved my hair 🙂

    October 29, 2007 at 4:32 PM
  • Ally Dora Reply

    There is certainly a lot to learn about this subject. I like all of the points you have made.

    January 12, 2022 at 5:14 PM
  • Sangalli Reply

    I’m thankful for the blog. Cool.

    November 18, 2023 at 12:52 AM
  • Kralik Reply

    Appreciate you sharing, great blog. Much thanks again. Great.

    November 20, 2023 at 4:17 PM
  • Daprile Reply

    Say, you got a nice blog post. Much thanks again. Will read on…

    December 1, 2023 at 8:56 AM
  • Vansickle Reply

    Wow, great blog article. Really thank you! Really Cool.

    December 9, 2023 at 6:58 PM
  • Janet Reply

    Great post. Really thank you! Really Cool.

    March 4, 2024 at 6:46 AM

Leave a Reply

Your email address will not be published. Required fields are marked *