急!急!急!Asp分页中的 跳转到第几页的后台代码怎么写!三层架构
小弟想用三层架构做分页,首页,上一页,下一页,尾页的后台代码都写好了,就差一个跳转到第几页的后台代码不知道怎么写了!哪位大侠帮帮忙!
下面是我已经完成的代码!!
//绑定
protected void Bind(int PageIndex)
{
PagedDataSource pds = new PagedDataSource();
pds.DataSource = BLL.result.GetSCaseList().DefaultView;
pds.AllowPaging = true;
pds.PageSize = 7;
lblTotalPage.Text = pds.PageCount.ToString();
lblCurrentPage.Text = (PageIndex + 1).ToString();
pds.CurrentPageIndex = PageIndex;
GridView1.DataSource = pds;
GridView1.DataBind();
}
//首页
protected void lnkFirst_Click(object sender, EventArgs e)
{
Bind(0);
}
//上一页
protected void lnkPrevious_Click(object sender, EventArgs e)
{
int CurrentIndex = Convert.ToInt32(lblCurrentPage.Text);
if (CurrentIndex == 1)
return;
Bind(CurrentIndex - 2);
}
//下一页
protected void lnkNext_Click(object sender, EventArgs e)
{
int CurrentIndex = Convert.ToInt32(lblCurrentPage.Text);
int PageCount = Convert.ToInt32(lblTotalPage.Text);
if (CurrentIndex == PageCount)
return;
Bind(CurrentIndex);
}
//最后一页
protected void lnkLast_Click(object sender, EventArgs e)
{
Bind(Convert.ToInt32(lblTotalPage.Text) - 1);
}
就还差点击跳转link_Click下的代码怎么写
<font>转到</font>
<asp:TextBox ID="txtlink" runat="server" Width="29px"></asp:TextBox>页
<asp:LinkButton ID="link" runat="server" TabIndex="1" Width="40px"
Font-Underline="False" CssClass="s" onclick="link_Click">转到</asp:LinkButton>
protected void link_Click(object sender, EventArgs e)
{
}