private void btnDeleteSelect_Click(object sender, System.EventArgs e) { System.Collections.Generic.IList <long> list = new System.Collections.Generic.List <long>(); foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.messagesList.Rows) { System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol"); if (checkBox != null && checkBox.Checked) { System.Web.UI.WebControls.Label label = (System.Web.UI.WebControls.Label)gridViewRow.FindControl("lblMessage"); if (label != null) { list.Add(System.Convert.ToInt64(label.Text)); } } } if (list.Count > 0) { CommentsHelper.DeleteMemberMessages(list); } else { this.ShowMessage("请选中要删除的收件", false); } this.BindData(); }
private void btnDeleteSelect_Click(object sender, EventArgs e) { IList <long> messageList = new List <long>(); foreach (GridViewRow row in this.messagesList.Rows) { CheckBox box = (CheckBox)row.FindControl("checkboxCol"); if ((box != null) && box.Checked) { Label label = (Label)row.FindControl("lblMessage"); if (label != null) { messageList.Add(Convert.ToInt64(label.Text)); } } } if (messageList.Count > 0) { CommentsHelper.DeleteMemberMessages(messageList); } else { this.ShowMessage("请选中要删除的收件", false); } this.BindData(); }