Exemple #1
0
    private void Bindcities(int ProvinceId)
    {
        try
        {
            ddlBranch.Items.Clear();
            ddlCities.Items.Clear();
            if (ProvinceId == 0)
            {
                ddlCities.Items.Insert(0, new ListItem("Select", "0"));
                return;
            }

            DataSet objDs = _objBalUser.GetCities(ProvinceId);
            if (objDs.Tables[0].Rows.Count > 0)
            {
                ddlCities.DataSource     = objDs;
                ddlCities.DataValueField = "CityId";
                ddlCities.DataTextField  = "CityName";
                ddlCities.DataBind();
                ddlCities.Items.Insert(0, new ListItem("Select", "0"));
            }
            else
            {
                ddlCities.Items.Insert(0, new ListItem("Select", "0"));
            }
        }
        catch (Exception ex)
        {
            labelError.Text = _objBOUtiltiy.ShowMessage("danger", "Error", ex.Message);
        }
    }