Ejemplo n.º 1
0
    //绑定数据1
    private void BindData()
    {
        U_UserNameBU user1 = new U_UserNameBU();

        int totalRow = 0;
        int curpage  = 1;

        if (ViewState["curpage"] != null)
        {
            curpage = (int)ViewState["curpage"];
        }

        DataSet ds1 = user1.GetAllUserList(curpage, this.status1.SelectedValue, this.PageNavigator1.PageSize, out totalRow);

        this.GridView1.DataSource = ds1;
        this.GridView1.DataBind();
        user1.Close();

        this.PageNavigator1.TotalRows   = totalRow;
        this.PageNavigator1.CurrentPage = curpage;

        if (ds1.Tables[0].Rows.Count == 0 && curpage > 1)
        {
            ViewState["curpage"] = curpage - 1;
            this.BindData();
        }

        if (totalRow == 0)
        {
            this.PageNavigator1.Visible = false;
        }
    }
Ejemplo n.º 2
0
    private void SetUserList()
    {
        String depart1 = this.depart.SelectedValue;

        if (String.IsNullOrEmpty(depart1) == false)
        {
            U_UserNameBU bu1 = new U_UserNameBU();
            DataSet      ds1 = bu1.GetAllUserList(depart1);
            bu1.Close();

            if (ds1 != null && ds1.Tables[0].Rows.Count > 0)
            {
                String oldValue = this.sname.SelectedValue;
                this.sname.Items.Clear();
                foreach (DataRow dr in ds1.Tables[0].Rows)
                {
                    ListItem list1 = new ListItem(dr["sname"].ToString(), dr["sname"].ToString());
                    this.sname.Items.Add(list1);
                }

                if (this.sname.Items.FindByValue(oldValue) != null)
                {
                    this.sname.SelectedValue = oldValue;
                }
            }
        }
    }
Ejemplo n.º 3
0
    //绑定人员
    protected void Repeater1_DataBound(object sender, RepeaterItemEventArgs e)
    {
        Label lab1 = e.Item.FindControl("labDepart") as Label;

        if (lab1 != null)
        {
            U_UserNameBU user1   = new U_UserNameBU();
            DataSet      Person1 = user1.GetAllUserList(lab1.Text);
            user1.Close();

            DataList datalist1 = e.Item.FindControl("DataListForPerson") as DataList;
            if (datalist1 != null)
            {
                datalist1.DataSource = Person1;
                datalist1.DataBind();
            }
            datalist1.Dispose();
        }
    }
Ejemplo n.º 4
0
 //绑定数据2
 private void BindData(U_UserNameBU user1)
 {
     this.GridView1.DataSource = user1.GetAllUserList();
     this.GridView1.DataBind();
 }