droplist綁定數組

 protected void Page_Load(object sender, EventArgs e)     {         ArrayList arr = new ArrayList();         arr.Add("1");         arr.Add("2");         arr.Add("2");

        DropDownList4.DataSource = arr;         DropDownList4.DataBind();

    }

    protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e)     {         switch (DropDownList4.SelectedValue)         {             case "1":                 Label1.Text = "1";                 break;             case "2":                 Label1.Text="2";                 break;             case "3":                 Label1.Text="3";                 break;         }     }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章