?using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; public partial class news : System.Web.UI.Page { public D d = new D(); public int t = -1; public string pre_next = string.Empty; public string Prev = ""; public string Next = ""; protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { string mid = Request["mid"] ?? ""; string id = Request["nid"] ?? ""; t = d.GetMenuSysType(mid,Convert.ToInt32(Request["t"]??"0")); if(t==0) { d.RepeaterBind(rep_about, d.GetAbout(mid)); }else if(t==1) { if (string.IsNullOrWhiteSpace(id)) { var d_tb = d.GetNews(mid); if (d_tb!=null) { if (d_tb.Rows.Count>pager1.PageSize) { pager1.TableSource = d_tb; d.RepeaterBind(rep_new, pager1.DataSource); } else { pager1.Visible = false; d.RepeaterBind(rep_new, d_tb); } } else { pager1.Visible = false; } } else { var cont = d.GetNews(mid,id); int clicks = (Convert.ToString(cont.Rows[0]["news11"]).Length==0?0:Convert.ToInt32(cont.Rows[0]["news11"]))+1; cont.Rows[0]["news11"] = clicks; d.RepeaterBind(rep_new_cont,cont); pre_next = d.GetPrevAndNextNews(mid, id); d.UpdateNewsClicks("news","news0",id,"news11",clicks); } } if (id != "") { C mdb = new C(); DataSet mds = new DataSet(); //Prev mds = mdb.GetDs("select top 1 * from news where news9=" + mid + " and news0<" + id + " order by news7 desc"); if (mds.Tables.Count > 0 && mds.Tables[0].Rows.Count > 0) { Prev = "

涓婁竴绡囷細" + mds.Tables[0].Rows[0]["news1"] + "

"; } else { Prev = "

涓婁竴绡囷細娌℃湁鏁版嵁

"; } //Next mds = mdb.GetDs("select top 1 * from news where news9=" + mid + " and news0>" + id + " order by news7 desc"); if (mds.Tables.Count > 0 && mds.Tables[0].Rows.Count > 0) { Next = "

涓嬩竴绡囷細" + mds.Tables[0].Rows[0]["news1"] + "

"; } else { Next = "

涓嬩竴绡囷細娌℃湁鏁版嵁

"; } } } } }