Development ASP.Net Tutorial

File: Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="ListDataBinding" %>



    Untitled Page


    
    

                             runat="server" 
                     Width="200px" 
                     Height="200px">
        
        
    
                              runat="server" 
                        Width="248px" 
                        Height="22px">
      
                              runat="server" 
                        Width="201px" 
                        Height="157px">
      
                                 runat="server" 
                           Width="249px" 
                           Height="158px">
        
     

    


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();
    }
}