Beispiel #1
0
    protected void GridBind()//第一次进入、查询、添加、删除和排序时使用
    {
        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();

        note.ordername    = ViewState["SortExpression"].ToString();
        note.orderMenthod = ViewState["SortDirection"].ToString();
        note.UnitCode     = _user.UnitCode;
        note.DYear        = DDL_Year.SelectedValue;
        note.DMonth       = DDL_Month.SelectedValue;
        if (DDL_State.SelectedValue != "")
        {
            note.State = int.Parse(DDL_State.SelectedValue);
        }
        GridSource = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
        if (GridSource.Rows.Count == 0 && currentPage > 1)
        {
            currentPage--;
            GridSource = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
        }
        total = note.total;
        GridView1.DataSource   = GridSource;
        GridView1.DataKeyNames = new string[] { "tableid", "name", "state", "islocked", "unitcode" };
        GridView1.DataBind();
        GridView1.SelectedIndex = -1;
        HF_Key.Value            = "";
        HF_State.Value          = "";
        //给HF和Session赋值
        HF_total.Value        = total.ToString();
        HF_currentPage.Value  = currentPage.ToString();
        Session["GridSource"] = GridSource;
    }
Beispiel #2
0
 protected void PagerButtonClick(object sender, EventArgs e)
 {
     try
     {
         int pagenum = total / (GridView1.PageSize);
         if (GridView1.PageSize * pagenum < total)
         {
             pagenum += 1;
         }
         if (txt_page.Text == "0")
         {
             txt_page.Text = "1";
         }
         else if (int.Parse(txt_page.Text) > pagenum)
         {
             txt_page.Text = pagenum.ToString();
         }
         GridView1.SelectedIndex = -1;
         HF_Key.Value            = "";
         HF_State.Value          = "";
         linkBtnPage.CommandName = txt_page.Text;
         EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
         note.ordername    = ViewState["SortExpression"].ToString();
         note.orderMenthod = ViewState["SortDirection"].ToString();
         note.UnitCode     = _user.UnitCode;
         note.DYear        = DDL_Year.SelectedValue;
         note.DMonth       = DDL_Month.SelectedValue;
         if (DDL_State.SelectedValue != "")
         {
             note.State = int.Parse(DDL_State.SelectedValue);
         }
         currentPage = Convert.ToInt32(((LinkButton)sender).CommandName);
         GridSource  = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
         GridBindFAPR();
         //给HF和Session赋值
         HF_total.Value        = total.ToString();
         HF_currentPage.Value  = currentPage.ToString();
         Session["GridSource"] = GridSource;
     }
     catch
     {
         Lb_result.Text = "输入页码非法!";
     }
 }
Beispiel #3
0
 protected void PagerButtonClick(object sender, EventArgs e)
 {
     try
     {
         int pagenum = total / (GridView1.PageSize);
         if (GridView1.PageSize * pagenum < total)
             pagenum += 1;
         if (txt_page.Text == "0")
             txt_page.Text = "1";
         else if (int.Parse(txt_page.Text) > pagenum)
             txt_page.Text = pagenum.ToString();
         GridView1.SelectedIndex = -1;
         HF_Key.Value = "";
         HF_State.Value = "";
         linkBtnPage.CommandName = txt_page.Text;
         EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();
         note.ordername = ViewState["SortExpression"].ToString();
         note.orderMenthod = ViewState["SortDirection"].ToString();
         note.UnitCode = _user.UnitCode;
         note.DYear = DDL_Year.SelectedValue;
         note.DMonth = DDL_Month.SelectedValue;
         if (DDL_State.SelectedValue != "")
             note.State = int.Parse(DDL_State.SelectedValue);
         currentPage = Convert.ToInt32(((LinkButton)sender).CommandName);
         GridSource = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
         GridBindFAPR();
         //给HF和Session赋值
         HF_total.Value = total.ToString();
         HF_currentPage.Value = currentPage.ToString();
         Session["GridSource"] = GridSource;
     }
     catch
     {
         Lb_result.Text = "输入页码非法!";
     }
 }
Beispiel #4
0
    //第一次进入、查询、添加、删除和排序时使用
    protected void GridBind()
    {
        EnterpriseOpration.Notification note = new EnterpriseOpration.Notification();

        note.ordername = ViewState["SortExpression"].ToString();
        note.orderMenthod = ViewState["SortDirection"].ToString();
        note.UnitCode = _user.UnitCode;
        note.DYear = DDL_Year.SelectedValue;
        note.DMonth = DDL_Month.SelectedValue;
        if (DDL_State.SelectedValue != "")
            note.State = int.Parse(DDL_State.SelectedValue);
        GridSource = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
        if (GridSource.Rows.Count == 0 && currentPage > 1)
        {
            currentPage--;
            GridSource = note.getOriginDataTableWithPublish(GridView1.PageSize, currentPage);
        }
        total = note.total;
        GridView1.DataSource = GridSource;
        GridView1.DataKeyNames = new string[] { "tableid", "name", "state", "islocked", "unitcode" };
        GridView1.DataBind();
        GridView1.SelectedIndex = -1;
        HF_Key.Value = "";
        HF_State.Value = "";
        //给HF和Session赋值
        HF_total.Value = total.ToString();
        HF_currentPage.Value = currentPage.ToString();
        Session["GridSource"] = GridSource;
    }