protected void Page_Load(object sender, EventArgs e) { Master.AddButton_Click += new PaidTimeOffEditGrid.ButtonClickedHandler(Master_AddButton_Click); if (!IsPostBack) { //Tell the control what class to create and what method to call to load the class. cgvWorkflow.ListClassName = typeof(ENTWFOwnerGroupEOList).AssemblyQualifiedName; cgvWorkflow.LoadMethodName = "Load"; //Action column-Contains the Edit link cgvWorkflow.AddBoundField("", "Actions", ""); var A = new ENTWFOwnerGroupEO(); //Name cgvWorkflow.AddBoundField("OwnerGroupName", "Name", "OwnerGroupName"); cgvWorkflow.AddBoundField("Description", "Description", "Description"); cgvWorkflow.DataBind(); } else { string eventTarget = Page.Request.Form["__EVENTTARGET"].ToString(); if (eventTarget.IndexOf("lbtnDelete") > -1) { //Rebind the grid so the delete event is captured. cgvWorkflow.DataBind(); } } }
void lbtnDelete_Command(object sender, CommandEventArgs e) { ENTValidationErrors validationErrors = new ENTValidationErrors(); ENTWFOwnerGroupEO workflowOwnerGroup = new ENTWFOwnerGroupEO(); workflowOwnerGroup.DBAction = ENTBaseEO.DBActionEnum.Delete; workflowOwnerGroup.ID = Convert.ToInt32(e.CommandArgument); workflowOwnerGroup.Delete(ref validationErrors, CurrentUser.ID); Master.ValidationErrors = validationErrors; cgvWorkflow.DataBind(); }