Пример #1
0
 private void LoadBranches(string RegionCode)
 {
     dataTable = datafile.GetDistrictByRegionCode(RegionCode);
     cboBranches.DataSource     = dataTable;
     cboBranches.DataValueField = "DistrictCode";
     cboBranches.DataTextField  = "DistrictName";
     cboBranches.DataBind();
     if (dataTable.Rows.Count > 0)
     {
         if (dataTable.Rows.Count == 1)
         {
             cboBranches.Enabled = false;
             string district = dataTable.Rows[0]["DistrictID"].ToString();
             cboBranches.SelectedIndex = cboBranches.Items.IndexOf(cboBranches.Items.FindByValue(district));
         }
         else
         {
             cboBranches.Enabled = true;
         }
     }
     else
     {
         cboBranches.Enabled = false;
     }
 }