1、<PagerSettings Visible="False" />
2、
currPage.Text = (GridView1.PageIndex + 1).ToString();
thePage.Text = (GridView1.PageIndex + 1).ToString();
pageCount.Text = GridView1.PageCount.ToString();
txtRCount.Text = dt.Rows.Count.ToString();
btnFirst.CommandName = "1";
btnPrev.CommandName = (GridView1.PageIndex == 0 ? "1" : GridView1.PageIndex.ToString());
btnNext.CommandName = (GridView1.PageCount == 1 ? GridView1.PageCount.ToString() : (GridView1.PageIndex + 2).ToString());
btnLast.CommandName = GridView1.PageCount.ToString();
3、
protected void btnFirst_Click(object sender, EventArgs e)
{
int iPage = Convert.ToInt32(((LinkButton)sender).CommandName) - 1;
if (iPage < 0)
iPage = 0;
GridView1.PageIndex = iPage;
dataBindGridView ();
}
protected void btnPrev_Click(object sender, EventArgs e)
{
int iPage = Convert.ToInt32(((LinkButton)sender).CommandName) - 1;
if (iPage < 0)
iPage = 0;
GridView1.PageIndex = iPage;
dataBindGridView ();
}
protected void btnNext_Click(object sender, EventArgs e)
{
int iPage = Convert.ToInt32(((LinkButton)sender).CommandName) - 1;
if (iPage < 0)
iPage = 0;
GridView1.PageIndex = iPage;
dataBindGridView ();
}
protected void btnLast_Click(object sender, EventArgs e)
{
int iPage = Convert.ToInt32(((LinkButton)sender).CommandName) - 1;
if (iPage < 0)
iPage = 0;
GridView1.PageIndex = iPage;
dataBindGridView ();
}
protected void btnJump_Click(object sender, EventArgs e)
{
if (thePage.Text.Trim().ToString() != "")
{
int iPageIndex = int.Parse(thePage.Text.Trim().ToString());
if (iPageIndex > GridView1.PageCount)
{
thePage.Text = GridView1.PageCount.ToString();
iPageIndex = GridView1.PageCount;
}
if (iPageIndex < 1)
{
thePage.Text = "1";
iPageIndex = 1;
}
GridView1.PageIndex = iPageIndex - 1;
dataBindGridView();
}
}
2、
currPage.Text = (GridView1.PageIndex + 1).ToString();
thePage.Text = (GridView1.PageIndex + 1).ToString();
pageCount.Text = GridView1.PageCount.ToString();
txtRCount.Text = dt.Rows.Count.ToString();
btnFirst.CommandName = "1";
btnPrev.CommandName = (GridView1.PageIndex == 0 ? "1" : GridView1.PageIndex.ToString());
btnNext.CommandName = (GridView1.PageCount == 1 ? GridView1.PageCount.ToString() : (GridView1.PageIndex + 2).ToString());
btnLast.CommandName = GridView1.PageCount.ToString();
3、
protected void btnFirst_Click(object sender, EventArgs e)
{
int iPage = Convert.ToInt32(((LinkButton)sender).CommandName) - 1;
if (iPage < 0)
iPage = 0;
GridView1.PageIndex = iPage;
dataBindGridView ();
}
protected void btnPrev_Click(object sender, EventArgs e)
{
int iPage = Convert.ToInt32(((LinkButton)sender).CommandName) - 1;
if (iPage < 0)
iPage = 0;
GridView1.PageIndex = iPage;
dataBindGridView ();
}
protected void btnNext_Click(object sender, EventArgs e)
{
int iPage = Convert.ToInt32(((LinkButton)sender).CommandName) - 1;
if (iPage < 0)
iPage = 0;
GridView1.PageIndex = iPage;
dataBindGridView ();
}
protected void btnLast_Click(object sender, EventArgs e)
{
int iPage = Convert.ToInt32(((LinkButton)sender).CommandName) - 1;
if (iPage < 0)
iPage = 0;
GridView1.PageIndex = iPage;
dataBindGridView ();
}
protected void btnJump_Click(object sender, EventArgs e)
{
if (thePage.Text.Trim().ToString() != "")
{
int iPageIndex = int.Parse(thePage.Text.Trim().ToString());
if (iPageIndex > GridView1.PageCount)
{
thePage.Text = GridView1.PageCount.ToString();
iPageIndex = GridView1.PageCount;
}
if (iPageIndex < 1)
{
thePage.Text = "1";
iPageIndex = 1;
}
GridView1.PageIndex = iPageIndex - 1;
dataBindGridView();
}
}