protected void GridViewProcedures_RowCommand(object sender, GridViewCommandEventArgs e) { int tempProcedureID = Convert.ToInt32(e.CommandArgument); int mycount = ProcedureList.Count(); //Response.Redirect(IngredientList.Count().ToString()); if (e.CommandName == "Delete") { if (ProcedureSession != null) { ProcedureList = ProcedureSession; //context.DeleteFromIngredient(tempIngredientID); ProcedureList.RemoveAt(tempProcedureID); ProcedureSession = ProcedureList; } } GridViewProcedures.DataSource = ProcedureList; GridViewProcedures.DataBind(); if (ProcedureList.Count() == 0) { //Response.Redirect("http://localhost:28901/Default.aspx"); ProcedureSession.Clear(); } }
protected void Page_Load(object sender, EventArgs e) { Page.MaintainScrollPositionOnPostBack = true; if (!IsPostBack) { if (IngredientSession != null) { IngredientSession.Clear(); } if (ProcedureSession != null) { ProcedureSession.Clear(); } } }