コード例 #1
0
 /// <summary>
 /// To perform action when page is loaded
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     //code to execute without refreshing the page.
     if (!IsPostBack)
     {
         //Initialise object to bind and navigate countries
         StateCountry coun = new StateCountry();
         DataSet      ds   = new DataSet();
         ds = coun.GetCounty();
         if (ds.Tables[0].Rows.Count > 0)
         {
             for (int i = 1; i <= ds.Tables[0].Rows.Count; i++)
             {
                 country.Items.Add("");
                 country.Items[i].Text  = ds.Tables[0].Rows[i - 1]["txtCountry_name"].ToString();
                 country.Items[i].Value = ds.Tables[0].Rows[i - 1]["intCountry_id"].ToString();
             }
         }
     }
 }