asp.net中GridView实现自定义分页
我想在ASP.NET中实现自定义分页,比如像<首页><上一页><下一页><共几页>这样的,不要gridview自带的,我的数据源不是直接的,而是放在Page_Load事件中,有人建议去网上下个分页控件,但我不知道具体怎么操作,请各位帮忙,望详细!
我的CS代码如下:
public partial class Search1 : System.Web.UI.Page
{
public string ds;
public void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request["zj"] != null)
{
if (Request["zj"] == "1")
{
str_zj += " and ([注册资本] > 1000 )";
}
else if (Request["zj"] == "2")
{
str_zj += " and ( [注册资本] <=1000 and [注册资本] >100)";
}
else if (Request["zj"] == "3")
{
str_zj += " and ([注册资本] <= 100 and [注册资本] >50 )";
}
else if (Request["zj"] == "4")
{
str_zj += " and ( [注册资本] <= 50 and [注册资本] > 1 )";
}
else if (Request["zj"] == "5")
{
str_zj += " and ([注册资本] <= 1 )";
}
}
string str_time = "";
if (Request["time1"] != null)
{
str_time += " and ([成立日期] between #" + Request["time1"] + "# and #" + Request["time2"] + "# )";
}
string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:/lp/WebSite3/app_data/王店.xls;Extended Properties='Excel 8.0;HDR=YES;IMEX=1'";
OleDbConnection oleCon = new OleDbConnection(strCon);
OleDbDataAdapter oleDA = new OleDbDataAdapter("select * from [Sheet1$] where 1>0 " + str_time + str_zj + " ", oleCon);
DataSet ds = new DataSet();
oleDA.Fill(ds);
dgBang.DataSource = ds;
dgBang.DataBind();
}
}
}