Пример #1
0
 protected void LstPageSize_SelectedIndexChanged(object sender, EventArgs e)
 {
     ViewState["PageSize"]    = LstPageSize.SelectedValue;
     ViewState["CurrentPage"] = "1";
     txtGoPage.Text           = "1";
     PagerClick.Invoke();
 }
Пример #2
0
    protected void pager_click(object sender, EventArgs e)
    {
        int        cp     = int.Parse(ViewState["CurrentPage"].ToString());
        int        pcount = int.Parse(ViewState["PageCount"].ToString());
        int        gopage = int.Parse(txtGoPage.Text);
        LinkButton lk     = (LinkButton)sender;

        switch (lk.ID)
        {
        case "FirstPage":
            ViewState["CurrentPage"] = 1;
            break;

        case "PrePage":
            ViewState["CurrentPage"] = Math.Max(cp - 1, 1);
            break;

        case "NextPage":
            ViewState["CurrentPage"] = Math.Min(cp + 1, pcount);
            break;

        case "LastPage":
            ViewState["CurrentPage"] = pcount;
            break;

        case "GoPage":
            gopage = Math.Max(gopage, 1);
            gopage = Math.Min(gopage, pcount);
            ViewState["CurrentPage"] = gopage;
            break;
        }
        txtGoPage.Text = ViewState["CurrentPage"].ToString();
        PagerClick.Invoke();
    }
Пример #3
0
    protected void txtGoPage_TextChanged(object sender, EventArgs e)
    {
        int cp     = int.Parse(ViewState["CurrentPage"].ToString());
        int pcount = int.Parse(ViewState["PageCount"].ToString());
        int gopage;

        if (int.TryParse(txtGoPage.Text, out gopage))
        {
            gopage = Math.Max(gopage, 1);
            gopage = Math.Min(gopage, pcount);
            ViewState["CurrentPage"] = gopage;
            txtGoPage.Text           = gopage.ToString();
            PagerClick.Invoke();
        }
        else
        {
            txtGoPage.Text = cp.ToString();
        }
    }