protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString.ToString());
con.Open();
com = new SqlCommand();
com.Connection = con;
com.CommandText = "SELECT * FROM dbo.hbase where nullb=1 and tel like '%" + this.dhhm.Text + "%' order by tel";
AspNetPager1.AlwaysShow = true;
AspNetPager1.PageSize = 15;
AspNetPager1.RecordCount = (int)com.ExecuteScalar();
con.Close();
DataListDataBind1();
}
private void DataListDataBind1()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString.ToString());
dr = new SqlDataAdapter("SELECT * FROM dbo.hbase where nullb=1 and tel like '%" + this.dhhm.Text + "%' order by tel", con);
ds = new DataSet();
dr.Fill(ds, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "hbase");
DataList1.DataSource = ds.Tables["hbase"];
DataList1.DataBind();
}
protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
{
AspNetPager1.CurrentPageIndex = e.NewPageIndex;
DataListDataBind1();
}
分页只显示第一页,谁帮帮我
page_load 里面米内容
|