protected void submit_Click(object sender, EventArgs e) { if (!Page.IsPostBack) { TextWriter textWriter = new StreamWriter("E:\\student.txt", true); textWriter.WriteLine(fname.Text); textWriter.WriteLine(lname.Text); textWriter.WriteLine(dob.Text); textWriter.WriteLine(university.Text); textWriter.WriteLine(gpa.Text); textWriter.WriteLine(major.Text); textWriter.Close(); Response.Write("Submit_Click executed"); List <string> statesList = StudentDatabase.StatesList(); state.DataSource = statesList; state.DataBind(); } confirm.Visible = true; Response.Redirect("~/Contact.aspx?FirstName=" + fname.Text + "&LastName=" + lname.Text) ; }
protected void state_SelectedIndexChanged(object sender, EventArgs e) { List <string> statesList = StudentDatabase.StatesList(); state.DataSource = statesList; state.DataBind(); switch (state.Text) { case "Florida": List <string> floridaCities = new List <string>(); floridaCities.Add("Tampa"); floridaCities.Add("Orlando"); floridaCities.Add("Gainsville"); if (!IsPostBack) { city.DataSource = floridaCities; city.DataBind(); } break; } }
protected void Page_Load(object sender, EventArgs e) { Response.Write("Page Load Event executed" + "<br/>"); if (!IsPostBack) { List <string> statesList = StudentDatabase.StatesList(); state.DataSource = statesList; state.DataBind(); } }