我在页面里面用“上一页”“下一页”换页。
总是只能点击“下一页”,并且只能点两次,再点就出错;如果点“上一页”一下就出错。
为什么?
总是只能点击“下一页”,并且只能点两次,再点就出错;如果点“上一页”一下就出错。
为什么?
解决方案 »
- 怎样实现WinFrom共用Click方法?
- sqlhelper 里面 我执行2个命令,怎么使用事务呢?
- 初学者求问:众多using system..何解。有没有using system清单:即using..代表什么.什么..
- 如何共用一个xmlhttp对象?
- 求救:一个数据提交的问题!!
- 用datalist遇到这个错误"找不到类型或命名空间名称“DataRowsView”
- 自么删除SQL中重复的记录
- 各位大侠,这个错误怎么解决啊? Hurry up,Help me!
- gridview中的若干问题求教---急。。。
- 简单的数据库问题:请问我如何用一个SQL语句,把表a中的number 字段的第三位改为0或1。也就是说我要用一个语句改变字段的值。
- 为什么我在页面里面用“上一页”“下一页”换页有问题
- 问个GridView全选全更新的问题
if (!IsPostBack)
{
string searchword = TextBox1.Text.ToString().Trim();
string btime = DropDownList1.Text.ToString().Trim();
string etime = DropDownList2.Text.ToString().Trim();
DataSet ds = new DataSet();
Class1 search = new Class1();
if (RadioButtonList1.Text == "篇名")
{
ds = search.searchone(searchword, btime, etime);
}
else if (RadioButtonList1.Text == "作者")
{
ds = search.searchtwo(searchword, btime, etime);
}
else if (RadioButtonList1.Text == "关键词")
{
ds = search.searchthree(searchword, btime, etime);
}
else if (RadioButtonList1.Text == "摘要")
{
ds = search.searchfour(searchword, btime, etime);
}
this.GridView1.DataSource = ds;
GridView1.AllowPaging = true;
GridView1.PageSize = 30;
GridView1.DataBind();
int i = ds.Tables[0].Rows.Count;
int p = GridView1.PageCount;
int q = GridView1.PageIndex + 1;
this.recount.Text = i.ToString();
this.pacount.Text = p.ToString();
this.pa.Text = q.ToString();
}
protected void Button2_Click(object sender, EventArgs e)//“首页”按钮代码
{
GridView1.PageIndex = 0;
bind();
}
protected void Button3_Click(object sender, EventArgs e)//“上一页”按钮代码
{
GridView1.PageIndex = GridView1.PageIndex - 1;
bind();
}
protected void Button4_Click(object sender, EventArgs e)“下一页”按钮代码
{
GridView1.PageIndex = GridView1.PageIndex + 1;
bind();
}
protected void Button5_Click(object sender, EventArgs e)“末页”按钮代码
{
GridView1.PageIndex = GridView1.PageCount - 1;
bind();
}
{}
下一页 得判断是不是比总页数还大