[求助]关于ArrayList
<SCRIPT language=C# runat=\"server\">
void Page_Load(Object Sender, EventArgs E) {
if (!Page.IsPostBack) {
ArrayList values = new ArrayList();
values.Add (\"IN\");
values.Add (\"KS\");
values.Add (\"MD\");
values.Add (\"MI\");
values.Add (\"OR\");
values.Add (\"TN\");
DropDown1.DataSource = values;
DropDown1.DataBind();
}
}
void SubmitBtn_Click(Object sender, EventArgs e) {
Label1.Text = \"您选择了:\" + DropDown1.SelectedItem.Text;
}
[code]<SCRIPT language=C# runat=\"server\">
void Page_Load(Object Sender, EventArgs E) {
if (!Page.IsPostBack) {
ArrayList values = new ArrayList();
values.Add (\"IN\");
values.Add (\"KS\");
values.Add (\"MD\");
values.Add (\"MI\");
values.Add (\"OR\");
values.Add (\"TN\");
DropDown1.DataSource = values;
DropDown1.DataBind();
}
}
void SubmitBtn_Click(Object sender, EventArgs e) {
Label1.Text = \"您选择了:\" + DropDown1.SelectedItem.Text;
}
</script>
<html>
<head>
<script language="C#" runat="server">
void Page_Load(Object Sender, EventArgs E) {
if (!Page.IsPostBack) {
ArrayList values = new ArrayList();
values.Add ("IN");
values.Add ("KS");
values.Add ("MD");
values.Add ("MI");
values.Add ("OR");
values.Add ("TN");
DropDown1.DataSource = values;
DropDown1.DataBind();
}
}
void SubmitBtn_Click(Object sender, EventArgs e) {
Label1.Text = "您选择了:" + DropDown1.SelectedItem.Text;
}
</script>
</head>
<body>
<h3><font face="宋体">数据绑定 DropDownList</font></h3>
<form runat=server>
<asp:DropDownList id="DropDown1" runat="server" />
<asp:button Text="提交" OnClick="SubmitBtn_Click" runat=server/>
<p>
<asp:Label id=Label1 font-name="宋体" font-size="10.5pt" runat="server" />
</form>
</body>
</html>
为什么说没有数据绑定
</script>[/code]
[此贴子已经被作者于2006-4-11 13:33:23编辑过]