protected void GridViewUnit_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView theGrid      = sender as GridView; // refer to the GridView
        int      newPageIndex = 0;

        if (-2 == e.NewPageIndex)
        { // when click the "GO" Button
            TextBox     txtNewPageIndex = null;
            GridViewRow pagerRow        = GridViewUnit.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
        {  // when click the first, last, previous and next Button
            newPageIndex = e.NewPageIndex;
        }

        // check to prevent form the NewPageIndex out of the range


        if (Label_Grid1_State.Text == "默认数据源")
        {
            Session["BindTable"] = BLLCraftBasicInfoMgt.BindUnit();
            BindData();
            UpdatePanelList.Update();
        }
        if (Label_Grid1_State.Text == "模糊搜索数据源")
        {
            Session["BindTable"] = BLLCraftBasicInfoMgt.SearchUnit(TextBoxUnit.Text.Trim());
            BindData();
            UpdatePanelList.Update();
        } //绑定数据源

        //bindgridview();
        newPageIndex = newPageIndex < 0 ? 0 : newPageIndex;
        newPageIndex = newPageIndex >= GridViewUnit.PageCount ? GridViewUnit.PageCount - 1 : newPageIndex;

        // specify the NewPageIndex
        GridViewUnit.PageIndex = newPageIndex;

        GridViewUnit.PageIndex = newPageIndex;
        GridViewUnit.DataBind();
    }
 /// <summary>
 /// 函数名:BindData
 /// 作用:绑定GridViewUnit的数据
 /// 作者:开济
 /// </summary>
 private void BindData()
 {
     GridViewUnit.DataSource = Session["BindTable"];
     GridViewUnit.DataBind();
 }