private void dgrCPD_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if (e.CommandName != "Page") { string EventPeriodIDValue = @"-1"; string Action = e.CommandName; Label EventID = (Label)e.Item.FindControl("lblEventID"); Label EventPeriodID = (Label)e.Item.FindControl("lblEventPeriodID"); string EventIDValue = EventID.Text; if (EventPeriodID.Text != "") { EventPeriodIDValue = EventPeriodID.Text; } Session["EventID"] = EventIDValue; Session["EventPeriodID"] = EventPeriodIDValue; switch (Action) { case "Edit": Response.Redirect(@"\Administration\CPD\cpdeventdetail.aspx"); break; case "Delete": string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked YES!')", true); BusinessServices.Event objEvent = new BusinessServices.Event(); objEvent.DeleteEventPeriod(Convert.ToInt32(EventPeriodIDValue)); Response.Redirect(@"\Administration\CPD\cpdevent.aspx"); } else { //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked NO!')", true); } break; case "Copy": Response.Redirect(@"\Administration\CPD\cpdeventdetail.aspx?IsCopy=copy"); break; } } }