示例#1
0
    //绑定Gridview
    private void BindGridview(string BDOS_Name, string HRP_Post)
    {
        string sortExpression = Grid_Post.Attributes["SortExpression"];
        string sortDirection  = Grid_Post.Attributes["SortDirection"];

        Grid_Post.DataSource = hRFilesMgtL.Search_HRPost(BDOS_Name, HRP_Post);
        Grid_Post.DataBind();
    }
示例#2
0
    protected void BtnSearch_Click(object sender, EventArgs e)
    {
        s = DdlDep.SelectedItem.ToString() == "请选择" ? "" : DdlDep.SelectedItem.ToString();

        Grid_Post.DataSource = hRFilesMgtL.Search_HRPost(s, TxtPost.Text);
        Grid_Post.DataBind();
        LblRecordIsSearch.Text  = "检索后";
        Grid_Post.SelectedIndex = -1;//如果Grid_Post存在行加黑,则取消加黑
        UpdatePanel_Post.Update();
    }
示例#3
0
    //Gridview翻页
    protected void Grid_Post_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView theGrid      = sender as GridView; // refer to the GridView
        int      newPageIndex = 0;

        if (-2 == e.NewPageIndex)
        {
            TextBox     txtNewPageIndex = null;
            GridViewRow pagerRow        = Grid_Post.BottomPagerRow;


            if (null != pagerRow)
            {
                txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox");   // refer to the TextBox with the NewPageIndex value
            }

            if (null != txtNewPageIndex && txtNewPageIndex.Text != "")
            {
                newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex
            }
        }
        else
        {
            newPageIndex = e.NewPageIndex;
        }
        //Grid_Post.DataBind();
        if (LblRecordIsSearch.Text == "检索前")
        {
            BindGridview("", "");
        }
        if (LblRecordIsSearch.Text == "检索后")
        {
            BindGridview(s, TxtPost.Text);
        }

        newPageIndex        = newPageIndex < 0 ? 0 : newPageIndex;
        newPageIndex        = newPageIndex >= Grid_Post.PageCount ? Grid_Post.PageCount - 1 : newPageIndex;
        Grid_Post.PageIndex = newPageIndex;
        Grid_Post.PageIndex = newPageIndex;
        Grid_Post.DataBind();
    }