How to put --select one-- or choose one in dropdownlist in asp.net using C#

In this article show how to add --select one-- or --choose one-- on the top of dropdownlist in asp.net using C#. I already post how to binding data in to dropdownlist from database in asp.net using C#.
 Code design:

<asp:DropDownList ID="Dropdownlist1" runat="server" Height="20px" Width="220px" AppendDataBoundItems="true">
   <asp:ListItem Value="-1" Text="-- All project--" Selected="true">
   </asp:ListItem>
</asp:DropDownList>
After design code dropdownlist, it's time to binding data to dropdownlistSee how to binding data into dropdownlist.
Note : -  AppendDataBoundItems="true" mean enable append items to dropdownlist.
          Value="-1": put the value is -1 because data binding from database, which value is started from 0. 


How to put --select one-- or choose one in dropdownlist in asp.net using C# How to put --select one-- or choose one in dropdownlist in asp.net using C# Reviewed by BeiLover on 8:46 PM Rating: 5

No comments:

Powered by Blogger.