CheckBoxList1.DataTextField = "dept_name";
        CheckBoxList1.DataValueField = "dept_id";
        CheckBoxList1.DataSource = ds2.Tables[temp2].DefaultView;
        CheckBoxList1.DataBind();
我把上面的写为一个类
public bool aaa(string name,string id,string check1)
{
        check1.DataTextField = name;
        check1.DataValueField = id;
        check1.DataSource = ds2.Tables[temp2].DefaultView;
        check1.DataBind();
}我感觉check1的对象不能这么写,请教各位达人~~~~

解决方案 »

  1.   

    public bool aaa(string name,string id,CheckBoxList check1)
    {
            check1.DataTextField = name;
            check1.DataValueField = id;
            check1.DataSource = ds2.Tables[temp2].DefaultView;
            check1.DataBind();
    }这样呢?楼主的目的是什么?
      

  2.   

    如果
    str=10,20,21,31,22,
    那么如何去掉最后一个“,”呢?