/// <summary> /// 控件行命令事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.Equals("del")) { int id = Convert.ToInt32(e.CommandArgument); QuestionInfoService.Delete(id); } sp.InitBindData(Repeater1, pager1, "QuestionInfo", "id", sear()); }
/// <summary> /// 批量删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { string ids = selInfo(); int num = 0; if (ids.Length == 0) { Jscript.Alert("请选择要删除的记录!", this.Page); return; } string[] arr = ids.TrimEnd(',').Split(','); for (int i = 0; i < arr.Length; i++) { if (QuestionInfoService.Delete(Convert.ToInt32(arr[i]))) { num++; } } ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('成功删除" + num + "条记录!');", true); sp.InitBindData(Repeater1, pager1, "QuestionInfo", "id", sear()); }