123456789101112131415161718192021222324252627282930313233 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- public partial class _Default : System.Web.UI.Page
- {
- AccessHelper helper = new AccessHelper();
- string cond = "caid=6";
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- helper.CreateCommand("select count(*) from news where "+cond);
- anp.RecordCount = int.Parse(helper.ExecuteScalar());
- bindrep();
- }
- }
- protected void anp_PageChanged(object sender, EventArgs e)
- {
- bindrep();
- }
- private void bindrep()
- {
- int pagesize = anp.PageSize;
- int pageindex = anp.CurrentPageIndex;
- gv.DataSource = helper.FengYe("(news n inner join newsca ca on n.caid=ca.id)", "*", "createdate", "desc", cond, pagesize, pageindex);
- gv.DataBind();
- }
- }
|