protected void Page_Load(object sender, EventArgs e) { account = (Account)this.Session["Account"]; if (account != null) { if (!this.IsPostBack) { pm = new ProductManagement(); lbxProducts.DataSource = pm.Products; lbxProducts.DataBind(); switch (account.Role) { case AccountType.Admin: { btnDeleteProduct.Enabled = true; break; } case AccountType.User: { btnDeleteProduct.Enabled = false; break; } } } } else { Response.Redirect("/Index.aspx"); } }