protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //default trip type if user do not select anything Session["tripType"] = "One Way"; GetFlightDetails getFlightDetails = new GetFlightDetails(); //bind distinct sources to drop down source listSource.DataSource = getFlightDetails.GetSource(); listSource.DataBind(); //bind distinct travel class to drop down listClass.DataSource = getFlightDetails.GetClass(); listClass.DataBind(); } //disabling dates before current day txtDateOfJourney.Attributes["min"] = DateTime.Now.ToString("yyyy-MM-dd"); txtDateOfReturn.Attributes["min"] = DateTime.Now.ToString("yyyy-MM-dd"); DropDownList1_SelectedIndexChanged(sender, e); }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { //bind distinct destination to drop down destination for which flight originate from selected source string source = listSource.Text; GetFlightDetails getFlightDetails = new GetFlightDetails(); listDestination.DataSource = getFlightDetails.GetDestination(source); listDestination.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { GetFlightDetails getFlightDetails = new GetFlightDetails(); DataTable airline = new DataTable(); airline = getFlightDetails.GetAirline(); //bind airline names to drop down list getAirline.DataSource = airline; getAirline.DataTextField = "FlightName"; getAirline.DataValueField = "FlightName"; getAirline.DataBind(); getAirline.Items.Insert(0, new ListItem("Select")); dtSearchFlightResults = (DataTable)Session["dtSearchFlightResults"]; Repeater1.DataSource = dtSearchFlightResults; Repeater1.DataBind(); int flagSelectedTrue = 0; Session["flagSelectedTrue"] = flagSelectedTrue; //Response.Write(Session["tripType"].ToString()); if (Session["tripType"].ToString().Equals("Round Trip")) { DataTable dtSearchFlightResultsRoundTrip = new DataTable(); dtSearchFlightResultsRoundTrip = (DataTable)Session["dtSearchFlightResultsRoundTrip"]; Repeater2.DataSource = dtSearchFlightResultsRoundTrip; Repeater2.DataBind(); int flagSelectedTrueRoundTrip = 0; Session["flagSelectedTrueRoundTrip"] = flagSelectedTrueRoundTrip; } } } catch (Exception) { } }