Пример #1
0
 protected void dataSource_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.ToString() == "del")
     {
         try
         {
             PolicyManageService.DeletePolicySetting(this.CurrentUser.UserName, Guid.Parse(e.CommandArgument.ToString()));
             btnQuery_Click(sender, e);
         }
         catch (Exception ex)
         {
             ShowExceptionMessage(ex, "删除");
         }
     }
 }
Пример #2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            List <Guid> ids = new List <Guid>();

            foreach (GridViewRow row in dataSource.Rows)
            {
                CheckBox chk = (CheckBox)row.FindControl("chkBox");
                Label    lbl = row.FindControl("lblId") as Label;
                if (chk.Checked)
                {
                    Guid id = Guid.Parse(lbl.Text);
                    ids.Add(id);
                }
            }
            if (ids.Count > 0)
            {
                PolicyManageService.DeletePolicySetting(this.CurrentUser.UserName,
                                                        ids.ToArray());
                btnQuery_Click(sender, e);
            }
        }