C# 分页程序 加一个跳转页
如跳转()页 go 谁有现成的代码分享一下。
如跳转()页 go 谁有现成的代码分享一下。
解决方案 »
- 客户端上传图片到服务器怎么实现自动压缩图片的大小那??
- 关于重写的一个问题,比较麻烦,请大家帮帮忙 谢谢~~~~~~~
- 闪烁效果
- 怎么在页面上显示5张图片
- 简单的问题,希望大虾能够帮忙看看(up者有分)
- 关于winform的 在实时刷新方面用timer控件好还是用多线程好
- 请问C#中函数、方法、属性三者的区别是什么?小弟有点迷糊了!!!!谢谢
- 打包msde的时候怎么同时也附加 数据库 谢谢 麻烦进来解决下 谢谢了 在线等
- 如何将数字转换为字符串?
- 关于COM+的安全性设置的疑问?请大家多指教
- C#做FTP上传文件,关于文件名包含#符合问题?望高手帮忙
- c#模拟声音的频率,时值,在音响中播放出声音
{
if (this.textBox2.Text != "" && textBox2.Text.ToString().Length == Encoding.Default.GetByteCount(textBox2.Text.ToString()))
{
if (int.Parse(this.textBox2.Text) > pagecount)
{
MessageBox.Show("当前查询结果没那么多页来跳转.");
}
else
{
kk1(int.Parse(this.textBox2.Text));
}
} }
<pagertemplate>
<table width="100%">
<tr>
<td style="text-align:right">
第 <asp:Label id="lblPageIndex" runat="server" text=' <%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
共/ <asp:Label id="lblPageCount" runat="server" text=' <%# ((GridView)Container.Parent.Parent).PageCount %>' />页
<asp:linkbutton id="btnFirst" runat="server" causesvalidation="False" commandargument="First" commandname="Page" text="首页" />
<asp:linkbutton id="btnPrev" runat="server" causesvalidation="False" commandargument="Prev" commandname="Page" text="上一页" />
<asp:linkbutton id="btnNext" runat="server" causesvalidation="False" commandargument="Next" commandname="Page" text="下一页" />
<asp:linkbutton id="btnLast" runat="server" causesvalidation="False" commandargument="Last" commandname="Page" text="尾页" />
<asp:textbox id="txtNewPageIndex" runat="server" width="20px" text=' <%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />
<asp:linkbutton id="btnGo" runat="server" causesvalidation="False" commandargument="-1" commandname="Page" text="GO" /> <!-- here set the CommandArgument of the Go Button to '-1' as the flag -->
</td>
</tr>
</table>
</pagertemplate> </asp:GridView>
aa.aspx.cs 文件
protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView2.PageIndex = e.NewPageIndex;
GridView2.DataBind();
}
{
page = ss;
getpagecount();
if (sqlvalue != "")
{
keysql = sqlvalue; }
if (page <= 1)
{
page = 1;
sqlpage = "select top " + pagesize + " * from 表1";
this.button2.Enabled = false;
if (pagecount > page)
{
this.button3.Enabled = true;
}
}
else if (page >= pagecount)
{
sqlpage = "select top " + pagesize + " * from 表1 where 序号 > (select max(序号) from (select top " + (page - 1) * pagesize + " 序号 from 表1 where order by 序号 asc) as temp) order by 序号 asc";
if (pagecount > 1)
{
this.button2.Enabled = true;
}
this.button3.Enabled = false;
}
else
{
sqlpage = "select top " + pagesize + " * from 表1 where 序号 > (select max(序号) from (select top " + (page - 1) * pagesize + " 序号 from 表1 where order by 序号 asc) as temp) order by 序号 asc";
this.button3.Enabled = true;
this.button2.Enabled = true;
} ds = ws.getdata1(sqlpage);
dt = ds.Tables[0];
this.dataGridView1.DataSource = dt;
this.toolStripStatusLabel3.Text = "当前页记录数为" + dt.Rows.Count.ToString() + "行";
{
if (sqlvalue != "")
{
keysql = " where " + sqlvalue; }
DataSet dw = ws.getdata1("select 序号 from 表1");
count = dw.Tables[0].Rows.Count; if (count % pagesize == 0)
{
pagecount = count / pagesize;
}
else
{
pagecount = count / pagesize + 1;
}
this.toolStripStatusLabel2.Text = "每页显示记录数为40行,共 " + pagecount.ToString() + " 页,当前第 " + page.ToString() + " 页,";
}
((TextBox)GridView1.BottomPagerRow.FindControl("txtGoPage")).Text)是空的
参考