예제 #1
0
        protected void UpdateByCountry()
        {
            if (cmbCountries.SelectedItem != null)
            {
                MCountryData mdata     = (MCountryData)cmbCountries.SelectedItem;
                int          IDCountry = mdata.Id;

                StatesHelper sth = new StatesHelper(IDCountry);

                cmbState.ValueMember   = "Id";
                cmbState.DisplayMember = "StateRegion1";
                cmbState.DataSource    = sth.Data;
                int idstate = 0;
                if (sth.Data != null)
                {
                    MStateRegionData sdata = (MStateRegionData)cmbState.SelectedItem;
                    if (sdata != null)
                    {
                        idstate = sdata.Id;
                    }
                }

                UpdateCityData(IDCountry, idstate);
            }
        }
예제 #2
0
 private void OnStateChanged(object sender, EventArgs e)
 {
     if (cmbState.SelectedValue != null)
     {
         int IdState = Convert.ToInt32(cmbState.SelectedValue);
         if (IdState > 0)
         {
             UpdateCityData(0, IdState);
         }
         else
         {
             MCountryData mdata     = (MCountryData)cmbCountries.SelectedItem;
             int          IDCountry = mdata.Id;
             UpdateCityData(IDCountry, 0);
         }
     }
 }