protected void Page_Load(object sender, EventArgs e) { buildings = BuildingBL.fillBuildingsList(); if (!IsPostBack) //need this to stop it reverting to the top value every button click { buildingDropdown.DataSource = buildings; buildingDropdown.DataValueField = "BuildingID"; buildingDropdown.DataTextField = "BuildingName"; buildingDropdown.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) //created by beau { buildings = BuildingBL.fillBuildingsList(); // Image1.ImageUrl = "~/Images/Room1.png"; if (!IsPostBack) //need this to stop it reverting to the top value every button click { buildingDropdown.DataSource = buildings; buildingDropdown.DataValueField = "BuildingID"; buildingDropdown.DataTextField = "BuildingName"; buildingDropdown.DataBind(); DropDownList1.DataSource = buildings; DropDownList1.DataValueField = "BuildingID"; DropDownList1.DataTextField = "BuildingName"; DropDownList1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { //Load data if user has initiated so, by button click. if ((string)Session["loggedUser"] != "admin") //stops non admins accessing page { Response.Redirect("home.aspx"); } buildings = BuildingBL.fillBuildingsList(); //Update building information if user has initiated so, by button click. if (!IsPostBack) { buildingDropdown.DataSource = buildings; buildingDropdown.DataValueField = "BuildingID"; buildingDropdown.DataTextField = "BuildingName"; buildingDropdown.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { buildings = BuildingBL.fillBuildingsList(); if (!IsPostBack) { //Sets relevant building fields inputBuildingSelecter.DataSource = buildings; inputBuildingSelecter.DataValueField = "BuildingID"; inputBuildingSelecter.DataTextField = "BuildingName"; inputBuildingSelecter.DataBind(); } if (inputBuildingSelecter.Items.Count < 1) { //If rooms are not found, output an error code & do not display building selector / goto building button sideLbl.Text = "No rooms found"; inputBuildingSelecter.Visible = false; goToBuildingButton.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { //Checks if a user is an administrator, and only grants an administrator access to this page if ((string)Session["loggedUser"] != "admin") { Response.Redirect("home.aspx"); } //Pulls all saved buildings from the database buildings = BuildingBL.fillBuildingsList(); //Uses the ASP control IsPostBack to determine if a post-back or user actioned button click has been performed if (!IsPostBack) { buildingDropdown.DataSource = buildings; //Fills the dropdown with all the buildings pulled from the database buildingDropdown.DataValueField = "BuildingID"; buildingDropdown.DataTextField = "BuildingName"; buildingDropdown.DataBind(); //Binds the ID / Name in the dropdown for user selection ddlbuildingDropDown_SelectedIndexChanged(sender, e); //Forces actions to reflect on user visual layer } }
protected void Page_Load(object sender, EventArgs e) { //Checks if a user is an administrator, and only grants an administrator access to this page if ((string)Session["loggedUser"] != "admin") { Response.Redirect("Login.aspx"); //If a user is not an administrator, it redirects to the login page for further processing } //Pulls all saved buildings from the database buildings = BuildingBL.fillBuildingsList(); //Uses the ASP control IsPostBack to determine if a user actioned button click has occurred if (!IsPostBack) { buildingDropdown.DataSource = buildings; //Fills the dropdown with values pulled from database buildingDropdown.DataValueField = "BuildingID"; buildingDropdown.DataTextField = "BuildingName"; buildingDropdown.DataBind(); //Binds the buildingID & buildingName to the data to be shown in the dropdown ddlbuildingDropDown_SelectedIndexChanged(sender, e); //Reflects these actions on the user display layer } }