protected void lv_B2CS_ItemCreated(object sender, ListViewItemEventArgs e) { try { uc_SupplyType_B2CS uc_SupplyType_B2CS = (uc_SupplyType_B2CS)e.Item.FindControl("uc_SupplyType_B2CS"); uc_SupplyType_B2CS.BindItems(); DropDownList ddlType = (DropDownList)e.Item.FindControl("ddlType"); if (ddlType != null) { foreach (EnumConstants.UserType r in Enum.GetValues(typeof(EnumConstants.UserType))) { ListItem item = new ListItem(Enum.GetName(typeof(EnumConstants.UserType), r), Convert.ToByte(r).ToString()); ddlType.Items.Add(item); } ddlType.Items.Insert(0, new ListItem(" [ SELECT ] ", "-1")); } } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); } }
protected void lv_B2CS_ItemDataBound(object sender, ListViewItemEventArgs e) { try { //Type DropDownList ddlType = (DropDownList)e.Item.FindControl("ddlType"); HiddenField hdnType = (HiddenField)e.Item.FindControl("hdnType"); HiddenField hdnCess = (HiddenField)e.Item.FindControl("hdnCess"); HiddenField hdnIGST = (HiddenField)e.Item.FindControl("hdnIGST"); HiddenField hdnSGST = (HiddenField)e.Item.FindControl("hdnSGST"); HiddenField hdnCGST = (HiddenField)e.Item.FindControl("hdnCGST"); HiddenField hdnTotalTaxableValue = (HiddenField)e.Item.FindControl("hdnTotalTaxableValue"); TextBox txtEcommerce = (TextBox)e.Item.FindControl("txtECommerce"); if (hdnType.Value != null && hdnType.Value != "") { ddlType.Items.FindByValue(hdnType.Value).Selected = true; } uc_SupplyType_B2CS uc_SupplyTypeB2Cs = (uc_SupplyType_B2CS)e.Item.FindControl("uc_SupplyType_B2CS"); uc_SupplyTypeB2Cs.BindItems(); uc_SupplyTypeB2Cs.TotalTaxable_Value = hdnTotalTaxableValue.Value; uc_SupplyTypeB2Cs.IntegratedTax = hdnIGST.Value; uc_SupplyTypeB2Cs.Cess = string.IsNullOrEmpty(hdnCess.Value as string) ? "0.0" : hdnCess.Value; uc_SupplyTypeB2Cs.StateTax = hdnSGST.Value; uc_SupplyTypeB2Cs.CentralTax = hdnCGST.Value; if (DisplayIndex == e.Item.DisplayIndex) { uc_SupplyTypeB2Cs.IntegratedTax_enable = true; uc_SupplyTypeB2Cs.CentralTax_enable = true; uc_SupplyTypeB2Cs.Cess_enable = true; uc_SupplyTypeB2Cs.StateTax_enable = true; uc_SupplyTypeB2Cs.TotalTaxable_enable = true; uc_SupplyTypeB2Cs.ddlPos_enable = true; uc_SupplyTypeB2Cs.ddlRate_enable = true; ddlType.Enabled = true; txtEcommerce.Enabled = true; } else { uc_SupplyTypeB2Cs.IntegratedTax_enable = false; uc_SupplyTypeB2Cs.CentralTax_enable = false; uc_SupplyTypeB2Cs.Cess_enable = false; uc_SupplyTypeB2Cs.StateTax_enable = false; uc_SupplyTypeB2Cs.TotalTaxable_enable = false; uc_SupplyTypeB2Cs.ddlPos_enable = false; uc_SupplyTypeB2Cs.ddlRate_enable = false; ddlType.Enabled = false; txtEcommerce.Enabled = false; } HiddenField hdnPos = (HiddenField)e.Item.FindControl("hdnPos"); if (hdnPos.Value != null && hdnPos.Value != "") { uc_SupplyTypeB2Cs.ddlPos_SelectedValue = hdnPos.Value; } HiddenField Hdn_SupplyType = (HiddenField)e.Item.FindControl("Hdn_SupplyType"); if (Hdn_SupplyType.Value != null && Hdn_SupplyType.Value != "") { uc_SupplyTypeB2Cs.ddlSupplyType_SelectedValue = Hdn_SupplyType.Value; } var UserId = Common.LoggedInUserID(); var StateCode = unitOfwork.AspnetRepository.Filter(x => x.Id == UserId).SingleOrDefault().StateCode; var POS_StateId = Convert.ToInt32(uc_SupplyTypeB2Cs.ddlPos_SelectedValue); var POS_StateCode = unitOfwork.StateRepository.Filter(x => x.StateID == POS_StateId).SingleOrDefault().StateCode; if (StateCode == POS_StateCode) { uc_SupplyTypeB2Cs.ddlSupplyType_SelectedValue = "1"; } else { uc_SupplyTypeB2Cs.ddlSupplyType_SelectedValue = "0"; } //Rate HiddenField hdnRate = (HiddenField)e.Item.FindControl("hdnRate"); if (hdnRate.Value != null && hdnRate.Value != "") { uc_SupplyTypeB2Cs.ddlRate_SelectedValue = hdnRate.Value; } } catch (Exception ex) { cls_ErrorLog ob = new cls_ErrorLog(); cls_ErrorLog.LogError(ex, Common.LoggedInUserID()); } }