コード例 #1
0
        protected void LstAddCountry_SelectedIndexChanged(object sender, EventArgs e)
        {
            string    count = LstAddCountry.SelectedItem.Value;
            DataTable dt    = tblstate(count);

            LstAddState.DataSource     = dt;
            LstAddState.DataTextField  = "state_name";
            LstAddState.DataValueField = "state_name";
            LstAddState.DataBind();
            string    state = LstAddState.SelectedItem.Value;
            DataTable dt1   = tblcity(state);

            LstAddCity.DataSource     = dt1;
            LstAddCity.DataTextField  = "city_name";
            LstAddCity.DataValueField = "city_name";
            LstAddCity.DataBind();
        }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
     Response.Cache.SetNoStore();
     if (!Page.IsPostBack)
     {
         DataTable dt = tblCountry();
         LstAddCountry.DataSource     = dt;
         LstAddCountry.DataTextField  = "country_name";
         LstAddCountry.DataValueField = "country_name";
         LstAddCountry.DataBind();
         string    count = LstAddCountry.SelectedValue;
         DataTable dt1   = tblstate(count);
         LstAddState.DataSource = dt1;
         LstAddState.DataBind();
         DataTable dt2 = tblcity(LstAddState.SelectedValue);
         LstAddCity.DataSource = dt2;
         LstAddCity.DataBind();
     }
 }