protected void RegionList_SelectedIndexChanged(object sender, System.EventArgs e) { foreach (DataRow datarow in RegionsSet.Tables["Regions"].Rows) { if (datarow.RowState != DataRowState.Deleted) { if ((int)datarow["ID"] == Convert.ToInt32(RegionList.SelectedValue)) { RegionName.Text = (string)datarow["Region"]; break; } } } CountriesSet.Clear(); try { if (Convert.ToInt32(RegionList.SelectedValue) != 0) { CountriesAdapter.SelectCommand.Parameters["@RegionID"].Value = Convert.ToInt32(RegionList.SelectedValue); //lock (CommonFunctions.Connection) CountriesAdapter.Fill(CountriesSet); } } catch (Exception) { } CountryList.DataBind(); CountryList2.DataBind(); CountryList_SelectedIndexChanged(CountryList, EventArgs.Empty); }
protected void Page_Load(object sender, EventArgs e) { UserSession us = Session["User"] as UserSession; try { UserSession.IsAuthorized(defined, Session["User"] as UserSession); } catch (UnauthorizedAccessException) { Response.Redirect(UserManager.GetDefaultPage(UserType.Invalid)); return; } if (!IsPostBack) { DataTable dt = LearningManagementSystem.Components.User.GetRegisteredCountryList(); CountryList.DataSource = dt; CountryList.DataTextField = "Country"; CountryList.DataValueField = "Country_Id"; CountryList.DataBind(); CountryList1.DataSource = dt; CountryList1.DataTextField = "Country"; CountryList1.DataValueField = "Country_Id"; CountryList1.DataBind(); CountryList2.DataSource = dt; CountryList2.DataTextField = "Country"; CountryList2.DataValueField = "Country_Id"; CountryList2.DataBind(); CountryList3.DataSource = dt; CountryList3.DataTextField = "Country"; CountryList3.DataValueField = "Country_Id"; CountryList3.DataBind(); CountryList4.DataSource = dt; CountryList4.DataTextField = "Country"; CountryList4.DataValueField = "Country_Id"; CountryList4.DataBind(); CountryList5.DataSource = dt; CountryList5.DataTextField = "Country"; CountryList5.DataValueField = "Country_Id"; CountryList5.DataBind(); CountryList6.DataSource = dt; CountryList6.DataTextField = "Country"; CountryList6.DataValueField = "Country_Id"; CountryList6.DataBind(); } }