asp.net自定义分页控件示例(3)

/// <summary>
        /// 設定頁面信息
        /// </summary>
        /// <param>DataSet的紀錄總數</param>

public void SetPageRecord(int dsCount)
        {
            LRecords.Text = dsCount.ToString();
            int mod= dsCount%_gv.PageSize;
            LPages.Text = (mod == 0 ? dsCount / _gv.PageSize : dsCount / _gv.PageSize + 1).ToString();
            LPage.Text = (_gv.PageIndex + 1).ToString();
            tbPage.Visible = true;
            SetPageButton();
        }

protected void txtpage_TextChanged(object sender, EventArgs e)
        {
            if (txtpage.Text != "")
            {
                try
                {
                    int index = int.Parse(txtpage.Text.Trim());
                    if (index <= _gv.PageCount && index >= 1)
                    {
                        _gv.PageIndex = index - 1;
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script. language='javascript'>alert('對不起,頁數超過索引范圍!');</script>");
                    }
                }
                catch
                {

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjzsjd.html