protected void Page_Load(object sender, EventArgs e) { if (Session["name"] != null) { if (!IsPostBack) { con.Open(); SqlCommand cmd = new SqlCommand("select * from ClientBankDetails a, BankAdminBankDetails b where a.UserName = '******' and a.BankIFSC = b.BABankIFSC", con); using (SqlDataReader dr = cmd.ExecuteReader()) { if (dr.HasRows) { Destination.DataSource = dr; Destination.DataTextField = "BABankBranch"; Destination.DataValueField = "BABankBranch"; Destination.DataBind(); Destination.Items.Add(new ListItem("Admin", "0")); } } DisplayRecord(); } } else { Session.Clear(); Response.Redirect("~//Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataView view = new DataView(getSegregationData()); DataTable distinctValuesDriver = view.ToTable(true, "Driver"); Driver.DataSource = distinctValuesDriver; Driver.DataTextField = "Driver"; Driver.DataValueField = "Driver"; Driver.DataBind(); DataTable distinctValuesChecker = view.ToTable(true, "Checker"); Checker.DataSource = distinctValuesChecker; Checker.DataTextField = "Checker"; Checker.DataValueField = "Checker"; Checker.DataBind(); PlateNo.DataSource = getSegregationData(); PlateNo.DataTextField = "PlateNo"; PlateNo.DataValueField = "PlateNo"; PlateNo.DataBind(); BCO.DataSource = getBranchCorpOffice(); BCO.DataTextField = "BranchCorpOfficeName"; BCO.DataValueField = "BranchCorpOfficeCode"; BCO.DataBind(); Destination.DataSource = getCityBCO(); Destination.DataTextField = "CityName"; Destination.DataValueField = "CityName"; Destination.DataBind(); } }
protected void BCO_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) { Destination.Text = ""; Destination.Items.Clear(); Destination.AppendDataBoundItems = true; Destination.Items.Add("All"); Destination.SelectedIndex = 0; Destination.DataSource = getCityBCO(); Destination.DataTextField = "CityName"; Destination.DataValueField = "CityName"; Destination.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BCO.DataSource = getBranchCorpOffice(); BCO.DataTextField = "BranchCorpOfficeName"; BCO.DataValueField = "BranchCorpOfficeCode"; BCO.DataBind(); BundleNumber.DataSource = getBundle(); BundleNumber.DataTextField = "SackNo"; BundleNumber.DataValueField = "SackNo"; BundleNumber.DataBind(); Destination.DataSource = getCityBCO(); Destination.DataTextField = "CityName"; Destination.DataValueField = "CityName"; Destination.DataBind(); } }
protected void fromdrop_SelectedIndexChanged(object sender, EventArgs e) { if (fromdrop.SelectedIndex == 0) { Destination.Enabled = false; } else { Destination.Enabled = true; } string connStr = ConfigurationManager.ConnectionStrings["BusTicketingConnectionString"].ConnectionString; Destination.Items.Clear(); DataTable dest = new DataTable(); using (SqlConnection con = new SqlConnection(connStr)) { try { SqlDataAdapter adapter = new SqlDataAdapter("SELECT destinationLocation FROM dbo.Schedule WHERE originLocation='" + fromdrop.SelectedValue + "'", con); adapter.Fill(dest); Destination.DataSource = dest; Destination.DataTextField = "destinationLocation"; Destination.DataValueField = "destinationLocation"; Destination.DataBind(); } catch (Exception ex) { // Handle the error } } // Add the initial item - you can add this even if the options from the // db were not successfully loaded Destination.Items.Insert(0, new ListItem("<Select Destination>", "0")); }