
<html>
		<script language="C#" runat="server">

        void Page_Load(Object Sender, EventArgs E) {

            if (!Page.IsPostBack) {

               ArrayList values = new ArrayList();

               values.Add ("北京");
               values.Add ("上海");
               values.Add ("广州");
               values.Add ("深圳");
               values.Add ("天津");
               values.Add ("济南");

               ListBox1.DataSource = values;
               ListBox1.DataBind();
            }
        }

        void SubmitBtn_Click(Object sender, EventArgs e) 
        {
			Label1.Text = "你的选择: ";
			foreach(System.Web.UI.WebControls.ListItem item in ListBox1.Items)
			{
				if(item.Selected == true)
					Label1.Text += item.Text;
			}
        }

		</script>
	<body>
		<h3><font face="Verdana">将ArrayList绑定到ListBox控件</font></h3>
		<form runat="server" ID="Form1">
			<asp:ListBox id="ListBox1" runat="server" SelectionMode="Multiple"></asp:ListBox>
			<asp:button Text="Submit" OnClick="SubmitBtn_Click" runat="server" ID="Button1" />
			<p>
				<asp:Label id="Label1" font-name="Verdana" font-size="10pt" runat="server" />
			</p>
		</form>
	</body>
</html>
