首页 > 其他 > 详细

Dropdownlist控件的事件处理

时间:2015-05-03 13:12:48      阅读:98      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!