Пример #1
0
        protected void SellerDropdown_SelectedIndexChanged(object sender, EventArgs e)
        {
            con.Open();

            //Check if the user selected a seller
            if (SellerDropdown.SelectedValue == "DefaultSeller")
            {
                VehicleDropdown.DataSource = new DataTable();
                VehicleDropdown.DataBind();
                return;
            }

            SqlDataAdapter adapter = new SqlDataAdapter("SELECT * from dbo.Vehicle WHERE Owner = @customerID", con);

            adapter.SelectCommand.Parameters.AddWithValue("@customerID", SellerDropdown.SelectedValue);

            DataTable dt = new DataTable();

            adapter.Fill(dt);

            VehicleDropdown.DataSource     = dt;
            VehicleDropdown.DataValueField = "ID";
            VehicleDropdown.DataTextField  = "Model";

            VehicleDropdown.DataBind();

            con.Close();
        }
Пример #2
0
 private void ClearForm()
 {
     SellerDropdown.SelectedIndex = 0;
     BuyerDropdown.SelectedIndex  = 0;
     VehicleDropdown.DataSource   = new DataTable();
     VehicleDropdown.DataBind();
     Price.Text = "";
 }