private void OnDistrictChange(ListViewItemEventArgs eArgs = null) { DropDownList ddlDistrictName = null; DropDownList ddlUpazilaName = null; if (eArgs != null) { ddlDistrictName = eArgs.Item.FindControl("ddlDistrictName") as DropDownList; ddlUpazilaName = eArgs.Item.FindControl("ddlUpazilaName") as DropDownList; } else if (lsv_SetupPage.InsertItem != null) { ddlDistrictName = this.lsv_SetupPage.InsertItem.FindControl("ddlDistrictName") as DropDownList; ddlUpazilaName = this.lsv_SetupPage.InsertItem.FindControl("ddlUpazilaName") as DropDownList; } else if (lsv_SetupPage.EditItem != null) { ddlDistrictName = this.lsv_SetupPage.EditItem.FindControl("ddlDistrictName") as DropDownList; ddlUpazilaName = this.lsv_SetupPage.EditItem.FindControl("ddlUpazilaName") as DropDownList; } ddlUpazilaName.Items.Clear(); if (ddlDistrictName.SelectedIndex > 0) { LoadComboRefGrid(ref ddlUpazilaName, ALRD_UpazilaInfoService.GetService().GetAll(new ALRD_UpazilaInfoEntity { DistrictID = long.Parse(ddlDistrictName.SelectedValue) }).ToList(), CommonFunctions.GetPropertyName((ALRD_UpazilaInfoEntity x) => x.DESCRIPT), CommonFunctions.GetPropertyName((ALRD_UpazilaInfoEntity x) => x.COMPID)); } }
protected void ddlDistrict_SelectedIndexChanged(object sender, EventArgs e) { ddlUpazilla.Items.Clear(); if (ddlDistrict.SelectedIndex > 0) { List <ALRD_UpazilaInfoEntity> upazila = ALRD_UpazilaInfoService.GetService().GetAll(new ALRD_UpazilaInfoEntity { DistrictID = long.Parse(ddlDistrict.SelectedValue) }).ToList(); LoadComboRef(ref ddlUpazilla, upazila, CommonFunctions.GetPropertyName((ALRD_UpazilaInfoEntity x) => x.DESCRIPT), CommonFunctions.GetPropertyName((ALRD_UpazilaInfoEntity x) => x.COMPID)); } }
private void LoadData() { IList <ALRD_UpazilaInfoEntity> itemList = new List <ALRD_UpazilaInfoEntity>(); try { LocalDataStore = ALRD_UpazilaInfoService.GetService().GetAll(new ALRD_UpazilaInfoEntity()).ToList(); if (LocalDataStore != null && LocalDataStore.Count > 0) { this.lsv_SetupPage.DataSource = LocalDataStore; } else { this.lsv_SetupPage.EditIndex = -1; this.lsv_SetupPage.InsertItemPosition = InsertItemPosition.FirstItem; this.lsv_SetupPage.DataSource = new List <ALRD_UpazilaInfoEntity>(); } this.lsv_SetupPage.DataBind(); } catch (Exception ex) { throw ex; } }