//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { HyCommon HyCommon = new HyCommon(); HyContent HyContent = new HyContent(); string ls_tip = "删除成功!"; for (int i = 0; i < rptList.Items.Count; i++) { //int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //删除记录 HyContent.ID = int.Parse(id); HyContent.Delete(); } } string pageUrl = HyCommon.CombUrlTxt("list_content.aspx", "page={0}&rnd={1}&cid={2}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid_url.Text + ""); //写系统日志 HyCommon.WriteLog("删除", "批量删除文章记录", Session["uid"].ToString(), Session["uname"].ToString()); Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
private void RptBind() { if (this.Request.QueryString["page"] != null) this.page = int.Parse(this.Request.QueryString["page"].ToString()); else this.page = 1; if (this.Request.QueryString["cid"] != null) this.txtcid_url.Text = this.Request.QueryString["cid"].ToString(); //this.txtKeywords.Text = this.keywords; txtPageNum.Text = this.pageSize.ToString(); txtPage.Text = this.page.ToString(); HyContent HyContent = new HyContent(); DataTable dt = new DataTable(); dt = HyContent.Getdocs(this.txtcid_url.Text, page, pageSize); this.totalCount = HyContent.GetdocsNum(this.txtcid_url.Text); //this.totalCount = dt.Rows.Count; //DataTable tempTable = dt.Clone(); //for (int i = (this.page - 1) * this.pageSize; i < this.page * this.pageSize; i++) //{ // if (i > dt.Rows.Count - 1) // break; // DataRow dr = tempTable.NewRow(); // for (int j = 0; j < dt.Columns.Count; j++) // { // dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; // } // tempTable.Rows.Add(dr); //} //rptList.DataSource = tempTable; rptList.DataSource = dt; rptList.DataBind(); HyCommon HyCommon = new HyCommon(); string pageUrl = HyCommon.CombUrlTxt("list_content.aspx", "page={0}&rnd={1}&cid={2}", "__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtcid_url.Text + ""); PageContent.InnerHtml = HyCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }