private void llenarcategorias() { CLNCategoria clncategoria = new CLNCategoria(); CENDatoscategoria cencategoria = new CENDatoscategoria(); List <CENCategoria> lista = new List <CENCategoria>(); try { cencategoria = clncategoria.Listadatoscategoria(); if (cencategoria.ErrorWebSer.TipoErr == CENConstante.g_const_0) { lista = cencategoria.DatosCategoria; DropDownList1.DataSource = lista; DropDownList1.DataValueField = "codigoCategoria"; DropDownList1.DataTextField = "descCategoria"; DropDownList1.DataBind(); DropDownList1.Items.Insert(CENConstante.g_const_0, new ListItem("--Seleccionar--", "0")); 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('" + cencategoria.ErrorWebSer.DescripcionErr + "');", true); } } catch (Exception ex) { throw ex; } }
public CENDatoscategoria Listadatoscategoria() { //CLASE DE LISTA DE CATEGORIAS CENDatoscategoria listacategoria = new CENDatoscategoria(); CADProducto consulta = new CADProducto(); try { listacategoria = consulta.CENdatoscategoria(); return(listacategoria); } catch (Exception ex) { throw ex; } }