Пример #1
0
	protected void StateProvince_SelectedIndexChanged(object sender, System.EventArgs e)
	{
		try
		{
			if (Convert.ToInt32 (StateProvince.SelectedValue) != 0)
			{
				CitiesSet.Clear ();
				CitiesAdapter.SelectCommand.Parameters["@StateProvinceID"].Value = Convert.ToInt32 (StateProvince.SelectedValue);
				//lock (CommonFunctions.Connection)
					CitiesAdapter.Fill (CitiesSet);
			}
			else
				CitiesSet.Clear ();
		}
		catch (Exception)
		{
			CitiesSet.Clear ();
		}
		City.DataBind ();
	}
Пример #2
0
    protected void StateList_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        foreach (DataRow datarow in StateProvincesSet.Tables["StateProvinces"].Rows)
        {
            if (datarow.RowState != DataRowState.Deleted)
            {
                if ((int)datarow["ID"] == Convert.ToInt32(StateList.SelectedValue))
                {
                    if (datarow["CountryID"] is int)
                    {
                        CountryList2.SelectedValue = ((int)datarow["CountryID"]).ToString();
                    }
                    StateName.Text = (string)datarow["StateProvince"];
                    if (datarow["titleoverride"] != null)
                    {
                        State_Title_override.Text = datarow["titleoverride"].ToString();
                    }
                    if (datarow["descriptionoverride"] != null)
                    {
                        State_Description_override.Text = datarow["descriptionoverride"].ToString();
                    }
                    break;
                }
            }
        }

        CitiesSet.Clear();
        try
        {
            if (Convert.ToInt32(StateList.SelectedValue) != 0)
            {
                CitiesAdapter.SelectCommand.Parameters["@StateProvinceID"].Value = Convert.ToInt32(StateList.SelectedValue);
                //lock (CommonFunctions.Connection)
                CitiesAdapter.Fill(CitiesSet);
            }
        }
        catch (Exception)
        {
        }

        CityList.DataBind();
        CityList_SelectedIndexChanged(CityList, EventArgs.Empty);
    }