File: Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="ListDataBinding" %>
Untitled Page
File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
public partial class ListDataBinding : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List fruit = new List();
fruit.Add("A");
fruit.Add("B");
fruit.Add("C");
fruit.Add("D");
fruit.Add("E");
fruit.Add("F");
fruit.Add("G");
fruit.Add("H");
MyListBox.DataSource = fruit;
MyDropDownListBox.DataSource = fruit;
MyHTMLSelect.DataSource = fruit;
MyCheckBoxList.DataSource = fruit;
MyRadioButtonList.DataSource = fruit;
this.DataBind();
}
}