Example #1
0
        /// <summary>
        /// to get the data from the database and bind it to the DrpVillage dropdown
        /// </summary>
        /// <param name="subCounty"></param>
        private void BindVillages(string subCounty)
        {
            ListItem firstListItem = new ListItem(DrpVillage.Items[0].Text, DrpVillage.Items[0].Value);

            DrpVillage.Items.Clear();

            if (subCounty != "0")
            {
                DrpVillage.DataSource     = (new MasterBLL()).LoadVillageData(subCounty);
                DrpVillage.DataTextField  = "VillageName";
                DrpVillage.DataValueField = "VillageID";
                DrpVillage.DataBind();
            }

            DrpVillage.Items.Insert(0, firstListItem);
            DrpVillage.SelectedIndex = 0;
        }