protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
{
//Fill State on selected country
ddlState.Items.Clear();
DataTable dtFetchStateOnCountry = new DataTable();
dtFetchStateOnCountry = objclsMasterClass.FetchStateBasedOnCountry(ddlCountry.SelectedValue);
for (int StateLength = 0; StateLength < dtFetchStateOnCountry.Rows.Count; StateLength++)
{
ListItem liState = new ListItem(dtFetchStateOnCountry.Rows[StateLength] ["vaStateName"].ToString(), dtFetchStateOnCountry.Rows[StateLength]["pkStateId"].ToString(), true);
ddlState.Items.Add(liState);
}
if (ddlState.Items.Count > 0)
{
//Fill District on defaultly selected state
ddlDistrict.Items.Clear();
DataTable dtFetchDistrictOnState = new DataTable();
dtFetchDistrictOnState = objclsMasterClass.FetchDistrictBasedOnState(ddlState.SelectedValue);
for (int DistrictLength = 0; DistrictLength < dtFetchDistrictOnState.Rows.Count; DistrictLength++)
{
ListItem liDistrict = new ListItem(dtFetchDistrictOnState.Rows[DistrictLength]["vaDistrictName"].ToString(), dtFetchDistrictOnState.Rows[DistrictLength]["pkDistrict"].ToString(), true);
ddlDistrict.Items.Add(liDistrict);
}
}
}
protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
{
//Fill District on selected state
ddlDistrict.Items.Clear();
DataTable dtFetchDistrictOnState = new DataTable();
dtFetchDistrictOnState = objclsMasterClass.FetchDistrictBasedOnState(ddlState.SelectedValue);
for (int DistrictLength = 0; DistrictLength < dtFetchDistrictOnState.Rows.Count; DistrictLength++)
{
ListItem liDistrict = new ListItem(dtFetchDistrictOnState.Rows[DistrictLength]["vaDistrictName"].ToString(), dtFetchDistrictOnState.Rows[DistrictLength]["pkDistrict"].ToString(), true);
ddlDistrict.Items.Add(liDistrict);
}
}
No comments:
Post a Comment