protected void Page_Load(object sender, EventArgs e) { if (Session["SecurityLevel"] == "M") { // binds the gridview if (!IsPostBack) { ManageUsersGridView.DataBind(); } } else { Response.Redirect("~/NoAccess.aspx"); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { // creates customer list List <Customer> lstCust = null; // addes customer to the list lstCust = objBAL.GetCustomerListByFilter(Customer.SearchFilter.LastName, txtSearchLastName.Text); if (lstCust.Count > 0) { // binds the customer list to grid. ManageUsersGridView.DataSource = lstCust; ManageUsersGridView.DataBind(); // set password field to true visibility lblPassword.Visible = true; txtPassword.Visible = true; // set everything to false visibility lblUserName.Visible = false; lblUserType.Visible = false; txtUserName.Visible = false; ddlUserType.Visible = false; btnUpdateUser.Visible = false; lblEmail.Visible = false; txtEmail.Visible = false; btnUpdateUser.Visible = false; txtPassword2.Visible = false; lblPassword2.Visible = false; lblUserUpdateConfirmed.Visible = false; } else { lblError.Visible = true; } } catch (Exception) { lblUserUpdateFailed.Visible = true; } }
protected void LoadData() { ManageUsersGridView.DataSource = userRepository.GetAllUsers(); ManageUsersGridView.DataBind(); }