protected void wdgNotes_ItemCommand(object sender, Infragistics.Web.UI.GridControls.HandleCommandEventArgs e) { int policyNoteID = 0; PolicyNote note = null; if (e.CommandName == "DoEdit") { policyNoteID = Convert.ToInt32(e.CommandArgument); using (PolicyNoteManager repository = new PolicyNoteManager()) { note = repository.Get(policyNoteID); pnlPolicyNoteEdit.Visible = true; pnlPolicyNotes.Visible = false; txtPolicyNote.Text = note.Notes; } ViewState["policyNoteID"] = policyNoteID.ToString(); } else if (e.CommandName == "DoRemove") { policyNoteID = Convert.ToInt32(e.CommandArgument); using (PolicyNoteManager repository = new PolicyNoteManager()) { note = repository.Get(policyNoteID); repository.Delete(note); btnPolicyNoteCancel_Click(null, null); } } }