using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class SysAdmin_Default2 : System.Web.UI.Page { static int pageN = 0; static PagedDataSource pds = null;//静态变量只初始化一次 protected void Page_Load(object sender, EventArgs e) { // if (!IsPostBack) { } //} //public void BindRep(int pageN) //{ // string str = "select a.id,b.tctitle,a.title_cn,a.editdate,a.source from newstab as a,newstypetab as b where a.tid=b.tid and a.tid='" + tid + "'"; // DataTable dt = DBH.DBHelper.GetDataSet(str); // pds = new PagedDataSource(); // pds.AllowPaging = true; // pds.PageSize = 5; // pds.DataSource = dt.DefaultView; // pds.CurrentPageIndex = pageN;// 获取当前页面, 让下面的 显示当前页面 // Repeater1.DataSource = pds; // Repeater1.DataBind(); //} //protected void AspNetPager1_PageChanged(object src, EventArgs e) //{ // //AspNetPager1.CurrentPageIndex = e.NewPageIndex; // BindData(); } public void BindRep(int pageN) { } protected void btnDel_Click(object sender, EventArgs e) { // string delId = ""; // //先遍历取得选中项 // for (int i = 0; i < this.Repeater1.Items.Count; i++) // { // CheckBox cbx = (CheckBox)Repeater1.Items[i].FindControl("cbx"); // Label lbl = (Label)Repeater1.Items[i].FindControl("lbl"); // if (cbx != null) // { // if (cbx.Checked) // { // delId += lbl.Text + ","; // } // } // } // //去掉最后一个, // delId = (delId + ")").Replace(",)", ""); // //Response.Write("删除的语句是:delete news_sosuo8_ where id_news_ in(" + delId + ")"); // //自己写删除语句吧 // SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["shann"].ConnectionString); // SqlCommand del = new SqlCommand("delete so where id in(" + delId + ")", conn); // conn.Open(); // int myupdate = del.ExecuteNonQuery(); // conn.Close(); // if (myupdate > 0) // { // Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", ""); // BindData(); } }