//this the method that saves the select lease to the database protected void uxLease_Click(object sender, EventArgs e) { //get the selected slip from the dropdown var selectedSlip = Convert.ToInt32(uxSlips.SelectedValue); //get the customerid from the session var sessionCustomerID = ((int)Session["CustomerID"]); var newLease = new Lease //create a new customer object entity class { SlipID = selectedSlip, //add info from text boxes to object CustomerID = sessionCustomerID, }; MarinaManager.AddLease(newLease); //call the add method to insert a new lease var mgr = new MarinaManager(); //call the method that gets the data for the lease for the customer uxSlipsGridview.DataSource = mgr.GetSlipsGridviewCustomer(sessionCustomerID); DataBind(); // calls information on the page var selectedDock = Convert.ToInt32(uxDocks.SelectedValue); //get the select docks value //call the method that gets the available slips on the selected dock //and populate the slips drop down uxSlips.DataSource = mgr.GetSlipsAvailable(selectedDock); uxSlips.DataTextField = "ID"; uxSlips.DataValueField = "ID"; uxSlips.DataBind(); }
//this method is for the docks dropdown that will be executed on a selection change protected void uxDocks_SelectedIndexChanged1(object sender, EventArgs e) { // get id from the drop down list var selectedDock = Convert.ToInt32(uxDocks.SelectedValue); var mgr = new MarinaManager(); //popluate the gridview with the available slips uxSlipsGridview.DataSource = mgr.GetSlipsAvailable(selectedDock); DataBind(); // calls it on the page; in particular: uxInstructors.DataBind(); }
//this method is for the docks dropdown that will be executed on a selection change protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { // get id from the drop down list var selectedDock = Convert.ToInt32(uxDocks.SelectedValue); uxSlips.Visible = true; Label2.Visible = true; //populate the slips drop down var mgr = new MarinaManager(); //call the method from the manager class with the select dock as a parameter uxSlips.DataSource = mgr.GetSlipsAvailable(selectedDock); uxSlips.DataTextField = "ID"; uxSlips.DataValueField = "ID"; uxSlips.DataBind(); }