码迷,mamicode.com
首页 > 其他好文 > 详细

Dropdownlist控件的事件处理

时间:2015-05-03 13:15:07      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

protected void bindhbdata(string chatid)
{
    string sql = "select * from staff where wechatid=‘"+ chatid +"‘";
    SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.mycon, CommandType.Text, sql);
    if(dr.Read())
    {
        this.unit.Text = dr["unit"].ToString();
        this.hcagent.Text = dr["staffname"].ToString();
        this.hcagent_tl.Text = dr["tl"].ToString();
        string sqltl = "select * from staff where unit=‘"+ dr["unit"].ToString () +"‘ and rank in (‘tl‘)";
        DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.mycon, CommandType.Text, sqltl);
        //DataRow NewRow = ds.Tables[0].NewRow();
        //ds.Tables[0].Rows.Add(NewRow);
        this.t_tl.DataSource = ds.Tables[0].DefaultView;
        this.t_tl.DataTextField = "staffname";
        t_tl.DataBind();
        t_tl.Items.Insert(0, new ListItem("请选择", "0"));

    }
    dr.Close();

}
protected void t_tl_SelectedIndexChanged(object sender, EventArgs e)
{
    string tlname= t_tl.SelectedValue;
    string t_agent = "select * from staff where tl=‘"+ tlname +"‘";
    DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.mycon, CommandType.Text, t_agent);
    t_hragent.DataSource = ds.Tables[0].DefaultView;
    t_hragent.DataTextField = "staffname";
    t_hragent.DataBind();

}

Dropdownlist控件的事件处理

标签:

原文地址:http://www.cnblogs.com/pp521/p/4473562.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!