예제 #1
0
        protected void btnRpt_Click(object sender, EventArgs e)
        {
            string ids = Request.Form["MsgId"];

            int success = 0;

            if (!string.IsNullOrEmpty(ids))
            {
                success += (from id in ids.Split(',') where !string.IsNullOrEmpty(id) select InternalMessage.Delete(int.Parse(id))).Count(bl => bl);

                AlertAndRedirect("成功删除" + success + "条记录");
            }
            else
            {
                AlertAndRedirect("请至少选择一条");
            }
            LoadData();
        }
예제 #2
0
        protected void btnRpt_Click(object sender, EventArgs e)
        {
            //string ids = Request.Form["MsgId"];


            bool   result = true;
            string ids    = "";
            int    index  = 0;

            //遍历repeater控件的itemtemplate模版
            foreach (RepeaterItem item in msg_data.Items)
            {
                if (index > 1)
                {
                    ids += ",";
                }
                CheckBox cb = (CheckBox)item.FindControl("ckbIndex"); //根据控件id获得控件对象,cdDelete是checkBox控件的id
                if (cb.Checked == true)
                {
                    Label  label = (Label)item.FindControl("lbmsid");
                    string id    = label.Text;
                    ids += id;
                }
            }
            int success = 0;

            if (!string.IsNullOrEmpty(ids))
            {
                success += (from id in ids.Split(',') where !string.IsNullOrEmpty(id) select InternalMessage.Delete(int.Parse(id))).Count(bl => bl);

                AlertAndRedirect("成功删除" + success + "条记录");
            }
            else
            {
                AlertAndRedirect("请至少选择一条");
            }
            LoadData();
        }