Beispiel #1
0
    protected void butCreateSchool_Click(object sender, EventArgs e)
    {
        string schoolName  = tbTxtSchool.Text;
        string schoolCity  = tbSchoolCity.Text;
        string schoolState = tbSchoolState.Text;

        if (!Schools.SchoolExists(schoolName, schoolCity, schoolState))
        {
            Schools.CreateSchool(schoolName, schoolCity, schoolState);
            // reload the schools into a list.
            lboxSchools.DataSource = Schools.GetAllSchools();
            lboxSchools.DataBind();
            errorMessage.Visible = false;
        }
        else
        {
            errorMessage.Visible = true;
        }
    }