数据源是一个手写代码的DataSet,如何分页呢?帮帮忙,我搞不定它。
我也没搞定,请说得详细些!
public partial class admin_jsjl : System.Web.UI.Page
{
protected oradb conn = new oradb();
protected DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
// if (!Page.IsPostBack)
// {
string sql = "select * from sjjl ";
conn.open();
// SqlConnection myConnection = new SqlConnection("Data Source=XIAOHUA;Initial Catalog=HRIS;User ID=sa");
OracleDataAdapter myCommand = new OracleDataAdapter(sql, conn.dbconn);
myCommand.Fill(ds, "SJJL");
this.GridView1.AllowPaging = true;
this.GridView1.DataSource = ds;
this.GridView1.DataBind();
// }
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
Response.Write(e.NewPageIndex);
if (e.NewPageIndex!=-1)
{
this.GridView1.PageIndex = e.NewPageIndex;
// rolesArray = Roles.GetAllRoles();
this.GridView1.DataSource = ds; //string[]
// GridView1.DataBind();
//this.GridView1.DataBind();
// DataBind();
}
}
}