//method to select data on edit private void BindSelected(int intCategorySNo) { lblMessage.Text = ""; objCategoryMaster.BindProductCategoryOnSNo(intCategorySNo, "SELECT_ON_Product_Category_SNo"); txtProductDesc.Text = objCategoryMaster.ProductDesc; txtProductCategoryMappingId.Text = Convert.ToString(objCategoryMaster.ProductCategoryMappingId.ToString()); ddlBusinessLine.SelectedIndex = ddlBusinessLine.Items.IndexOf(ddlBusinessLine.Items.FindByValue(objCategoryMaster.BusinessLine_Sno.ToString())); ddlBusinessLine_SelectIndexChanged(null, null); if (ddlUnitSno.SelectedValue != null) { for (int intCnt = 0; intCnt < ddlUnitSno.Items.Count; intCnt++) { if (ddlUnitSno.Items[intCnt].Value.ToString() == objCategoryMaster.UnitSno.ToString()) { ddlUnitSno.SelectedIndex = intCnt; } } } objCategoryMaster.BindDdl(ddlCategoryDesc, int.Parse(ddlUnitSno.SelectedValue.ToString()), "FILLProductCategory", Membership.GetUser().UserName.ToString()); if (ddlCategoryDesc.SelectedValue != null) { for (int intCnt = 0; intCnt < ddlCategoryDesc.Items.Count; intCnt++) { if (ddlCategoryDesc.Items[intCnt].Value.ToString() == objCategoryMaster.CategorySNo.ToString()) { ddlCategoryDesc.SelectedIndex = intCnt; } } } // Code for selecting Status as in database for (intCnt = 0; intCnt < rdoStatus.Items.Count; intCnt++) { if (rdoStatus.Items[intCnt].Value.ToString().Trim() == objCategoryMaster.ActiveFlag.ToString().Trim()) { rdoStatus.Items[intCnt].Selected = true; } else { rdoStatus.Items[intCnt].Selected = false; } } }
// Added by Gaurav Garg protected void ddlBusinessLine_SelectIndexChanged(object sender, EventArgs e) { if (ddlBusinessLine.SelectedIndex != 0) { objCategoryMaster.BindDdl(ddlUnitSno, int.Parse(ddlBusinessLine.SelectedValue.ToString()), "SELECT_ALL_UNITCODE_UNITSNO", Membership.GetUser().UserName.ToString()); } else { ddlUnitSno.Items.Clear(); ddlUnitSno.Items.Insert(0, new ListItem("Select", "0")); } }