protected void btnEventSearchByAgency_Click(object sender, EventArgs e) { EventServiceRef.EventService eventService = new EventServiceRef.EventService(); DataSet agencies = eventService.GetEventAgencies(txtEventCity.Text, ddlEventState.SelectedValue); EventServiceRef.Agency agency = new EventServiceRef.Agency(); agency.ID = (int)agencies.Tables[0].Rows[ddlEventAgencies.SelectedIndex]["agencyID"]; agency.name = ddlEventAgencies.SelectedValue; agency.phone = (string)agencies.Tables[0].Rows[ddlEventAgencies.SelectedIndex]["agencyPhone"]; agency.email = (string)agencies.Tables[0].Rows[ddlEventAgencies.SelectedIndex]["agencyEmail"]; agency.city = (string)agencies.Tables[0].Rows[ddlEventAgencies.SelectedIndex]["agencyCity"]; agency.state = (string)agencies.Tables[0].Rows[ddlEventAgencies.SelectedIndex]["agencyState"]; DataSet myDS = eventService.GetEvents(agency, txtEventCity.Text, ddlEventState.SelectedValue); rptEvents.DataSource = myDS; rptEvents.DataBind(); divEventForm.Visible = false; divEventResults.Visible = true; }
protected void btnEventSelectCity_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtEventCity.Text)) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "Alert", "alert('Please enter a valid city.')", true); return; } if (ddlEventState.SelectedValue == "Select state") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "Alert", "alert('Please select a state.')", true); return; } EventServiceRef.EventService eventService = new EventServiceRef.EventService(); DataSet agencies = eventService.GetEventAgencies(txtEventCity.Text, ddlEventState.SelectedValue); ddlEventAgencies.DataSource = agencies; ddlEventAgencies.DataTextField = "agencyName"; ddlEventAgencies.DataValueField = "agencyName"; ddlEventAgencies.DataBind(); divEventDetails.Visible = true; }