protected void imgbtndiscard_Click(object sender, EventArgs e) { if (grdSentMailList.Rows.Count > 0) { foreach (GridViewRow GR in grdSentMailList.Rows) { CheckBox chk = (CheckBox)GR.FindControl("chkMsg"); if (chk.Checked == true) { Int32 MsgId = Convert.ToInt32(grdSentMailList.DataKeys[GR.RowIndex].Value); bool del = clsMessage.UpdateMsgMasterforSendDeleteExt(MsgId, "Deleted"); if (del == true) { pnlmsg.Visible = true; lblmsg.Text = "Record Discard Successfully"; lblmsg.Visible = true; } } } SelectMsgforSendBox(); } }