private void llenarListaSubCategorias() { int categoria = Convert.ToInt32(DropDownList1.SelectedValue); CLNSubCategoria clnsubcategoria = new CLNSubCategoria(); CENDatoSubscategoria cencsubategoria = new CENDatoSubscategoria(); List <CENSubCategoria> lista = new List <CENSubCategoria>(); try { cencsubategoria = clnsubcategoria.Listadatossubcategorias(categoria); if (cencsubategoria.ErrorWebSer.TipoErr == CENConstante.g_const_0) { lista = cencsubategoria.DatosSubCategoria; DropDownList2.DataSource = lista; DropDownList2.DataValueField = "codigoSubCategoria"; DropDownList2.DataTextField = "descSubCategoria"; DropDownList2.DataBind(); DropDownList2.Items.Insert(CENConstante.g_const_0, new ListItem("--Seleccionar--", "0")); } else { Page page = HttpContext.Current.Handler as Page; ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "alert('" + cencsubategoria.ErrorWebSer.DescripcionErr + "');", true); } } catch (Exception ex) { throw ex; } }
public static List <CENSubcategoria> ListarSubCategoria(int codCat) { CLNSubCategoria subCategoria = null; List <CENSubcategoria> ListaSubCategoria = null; try { subCategoria = new CLNSubCategoria(); ListaSubCategoria = subCategoria.ListarSubCategoriasPorCategoria(codCat); } catch (Exception ex) { throw ex; } return(ListaSubCategoria); }