net2:DropDownList的使用

别说谁变了你拦得住时间么 提交于 2020-01-08 04:20:38

原文发布时间为:2008-07-29 —— 来源于本人的百度文章 [由搬家工具导入]

using System;
using System.Data;
using System.Configuration;
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;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownList1.Items.Add("sf");
            DropDownList1.Items.Add("nv");
        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DropDownList1.Items.Add(TextBox1.Text);
    }
    protected void Button1_Command(object sender, CommandEventArgs e)
    {

    }
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        switch (DropDownList2.SelectedValue)//要把AUTOPOSTBACK变成true属性
        {
            case "a":
                Label1.Text = "1";
                break;
            case "b":
                Label1.Text = "2";
                break;
            case "c":
                Label1.Text = "3";
                break;
        }
    }
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        if (CheckBox1.Checked)
        {
            Label2.Text = "xuan zhong";
        }
        else
        {
            Label2.Text = "wei xuan zhong";
        }
    }
}

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!