Esempio n. 1
0
 protected void AdminSignUpButton_Click(object sender, EventArgs e)
 {
     if (MultiView2.GetActiveView() == AdminSignUp)
     {
         MultiView2.SetActiveView(emptyView);
     }
     else
     {
         MultiView2.SetActiveView(AdminSignUp);
     }
     using (SqlConnection connection = new SqlConnection(connectionString))
     {
         SqlCommand command = new SqlCommand("EXEC ListAllCities", connection);
         connection.Open();
         SqlDataReader reader = command.ExecuteReader();
         signupcitylist.DataSource     = reader;
         signupcitylist.DataTextField  = "Name";
         signupcitylist.DataValueField = "ID";
         signupcitylist.DataBind();
     }
     using (SqlConnection connection = new SqlConnection(connectionString))
     {
         signupdistrictlist.Items.Clear();
         SqlCommand command = new SqlCommand("EXEC ListAllDistrictsWithCity " + signupcitylist.SelectedItem.Value, connection);
         connection.Open();
         SqlDataReader reader = command.ExecuteReader();
         signupdistrictlist.DataSource     = reader;
         signupdistrictlist.DataTextField  = "Name";
         signupdistrictlist.DataValueField = "ID";
         signupdistrictlist.DataBind();
     }
 }