コード例 #1
0
    protected void Gridview_SupplyInfo_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        = Gridview_SupplyInfo.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;
        }
        string Condition = GetCondition();

        BindGridView_Supplyinfo(Condition);
        Gridview_SupplyInfo.DataBind();
        newPageIndex = newPageIndex < 0 ? 0 : newPageIndex;
        newPageIndex = newPageIndex >= Gridview_SupplyInfo.PageCount ? Gridview_SupplyInfo.PageCount - 1 : newPageIndex;
        Gridview_SupplyInfo.PageIndex = newPageIndex;
        Gridview_SupplyInfo.DataBind();
    }
コード例 #2
0
 //执行查找供应商
 private void BindGridView_Supplyinfo(string Condition)
 {
     try
     {
         Gridview_SupplyInfo.DataSource = pms.SelectPMSupplyInfo(Condition);
         Gridview_SupplyInfo.DataBind();
     }
     catch (Exception)
     {
         throw;
     }
 }