Blog Archives

Bind Generic List to ASP.NET DropDownList Example

Let us suppose you had a simple class of tags that you wanted to bind to an ASP.NET DropDownList control. public class TagDetails { private int tagID; public int TagID { get { return tagID; } } private string tagName;

Tagged with: ,
Posted in ASP.NET

Add Item to DropDownList After DataBind

We often want the first option in a drop-down list to not default to the first item in the list. Instead we would prefer the option of adding a –Select Item– at the top of the asp:DropDownList. After the DataBind,

Tagged with: ,
Posted in ASP.NET

SortedList Example for ASP.NET in C#

The SortedList object uses a key/value combination to sort a list. The SortedList can be databound to the following ASP.NET controls: asp:RadioButtonList asp:CheckBoxList asp:DropDownList asp:ListBox Our examples will bind a SortedList to an asp:ListBox. <asp:ListBox ID=”lsbPresidents” runat=”server” /> Numeric Sort

Tagged with: , , , ,
Posted in C#, VB.NET