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 (3)

  • 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

Leave a Reply

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