示例#1
0
    public void BindData()
    {
        U_UserNameBU user1 = new U_UserNameBU();

        U_DepartBU depart1 = new U_DepartBU();
        DataSet    ds1     = depart1.GetAllDepart();

        for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
        {
            Label lab1 = this.DataList0.Parent.FindControl("Label" + i) as Label;
            if (lab1 != null && ds1.Tables[0].Rows[i]["depart"] != null &&
                ds1.Tables[0].Rows[i]["depart"].ToString() != "")
            {
                lab1.Text = ds1.Tables[0].Rows[i]["depart"].ToString();
                DataList datalist1 = this.DataList0.Parent.FindControl("DataList" + i) as DataList;
                if (datalist1 != null)
                {
                    DataSet ds2 = user1.GetUserByDepart(lab1.Text);
                    datalist1.DataSource = ds2;
                    datalist1.DataBind();

                    if (ds2 != null && ds2.Tables[0].Rows.Count >= 0)
                    {
                        lab1.Parent.FindControl("Div" + i).Visible = true;
                    }
                }
            }
        }
        depart1.Close();
        user1.Close();
    }
示例#2
0
    //bind data1
    private void BindData()
    {
        U_DepartBU depart1 = new U_DepartBU();

        this.GridView1.DataSource = depart1.GetAllDepart();
        this.GridView1.DataBind();
        depart1.Close();
    }
示例#3
0
 //bind data2
 private void BindData(U_DepartBU depart1)
 {
     this.GridView1.DataSource = depart1.GetAllDepart();
     this.GridView1.DataBind();
 }