// (TO-DO) This and AdminLoginEdit need to have a base page for similiar functionality. protected void Page_Load(object sender, EventArgs e) { if (!Page.User.Identity.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } if (!IsPostBack) { if (PreviousPage is DefaultScreen ds) { qcs.EmpID = ds.EmpID; qcs.PermID = ds.PermID; // Makes sure the page is being accessed by someone with an acceptable permission type (1 or 2) if (qcs.PermID < 3) { PricingGridView.DataBind(); PricingDetailsView.DataBind(); } else { Response.Redirect("~/DefaultScreen.aspx"); } } else { Response.Redirect("~/DefaultScreen.aspx"); } } Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1)); Response.Cache.SetNoStore(); }
protected void PricingDetailsView_ItemCreated(object sender, EventArgs e) { // As each button in the command field is created, it detects if the button is the delete button. // If it is, an attribute is added to make a javascript prompt display to confirm the action when pressed. int commandRowIndex = PricingDetailsView.Rows.Count - 1; if (commandRowIndex != -1) { DetailsViewRow row = PricingDetailsView.Rows[commandRowIndex]; if (row.Controls[0].Controls.OfType <Button>().Where(b => b.CommandName == "Delete").Count() > 0) { Button btnDelete = row.Controls[0].Controls.OfType <Button>().Where(b => b.CommandName == "Delete").FirstOrDefault(); btnDelete.Attributes["onclick"] = "if(!confirm('Do you want to delete this Pricing?')){ return false; };"; } } PricingGridView.DataBind(); }
protected void PricingDetailsView_ItemCommand(object sender, DetailsViewCommandEventArgs e) { PricingGridView.DataBind(); }