求助: DataList 分页写完了 查询列以后 我想点下一页的时候还是显示查询列信息 如何绑定 我一点下一页就没查询了
前台就一个2个多选按钮 点几排序 一翻页 就没效果了 求请如何绑定 谁会帮帮我 以下是后台代码 数据库是SQL2000 绑的jobs表using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
DBcon db = new DBcon();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
bind();
}
}
public void bind()
{
PagedDataSource Objpage = new PagedDataSource();
Objpage.DataSource =db.Search("select * from jobs").DefaultView;
Objpage.AllowPaging = true;
Objpage.PageSize = 4;
int curpage;
if (Request["page"] != null)
{
curpage = int.Parse(Request["page"]);
}
else
{
curpage = 1;
}
Objpage.CurrentPageIndex = curpage - 1;
if (!Objpage.IsFirstPage)
pre.NavigateUrl = Request.CurrentExecutionFilePath + "?page=" + Convert.ToString(curpage - 1);
if (!Objpage.IsLastPage)
next.NavigateUrl = Request.CurrentExecutionFilePath + "?page=" + Convert.ToString(curpage + 1);
this.DataList1.DataSource = Objpage;
lblye.Text = curpage.ToString() + "页";
this.DataList1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
if (CheckBox1.Checked)
{
DataList1.DataSource = db.Search("select * from jobs order by job_id");
DataList1.DataBind();
}
if (CheckBox2.Checked) {
DataList1.DataSource = db.Search("select * from jobs order by job_id desc");
DataList1.DataBind();
}
}
}
--------------------编程问答--------------------
--------------------编程问答-------------------- 起用了ViewState 吗?
protected void Page_Load(object sender, EventArgs e)
{
//不使用IsPostBack
//if (!Page.IsPostBack)
//{
bind();
//}
}
--------------------编程问答-------------------- 点完下一页 他又从新绑定了 又变回原来的了 --------------------编程问答-------------------- 谁来帮帮我啊
补充:.NET技术 , ASP.NET