Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataTable Categorias = new BLL.CategoriasBLL().ConsultarCategorias();
         ddlCategorias.DataSource     = Categorias;
         ddlCategorias.DataValueField = "ID";
         ddlCategorias.DataTextField  = "Categoria";
         ddlCategorias.DataBind();
     }
 }
Ejemplo n.º 2
0
        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var dd = e.Row.FindControl("ddlCategoria") as DropDownList;
                if (dd != null)
                {
                    DataTable Categorias = new BLL.CategoriasBLL().ConsultarCategorias();
                    dd.DataSource     = Categorias;
                    dd.DataValueField = "Id";
                    dd.DataTextField  = "Categoria";
                    dd.DataBind();

                    //dd.SelectedValue = (e.Row.FindControl("lblCategoria") as Label).Text;
                }
            }
        }
Ejemplo n.º 3
0
        protected void btnAgregarCategoria(object sender, EventArgs e)
        {
            string mensaje = new BLL.CategoriasBLL().CrearCategoria(txtCategoria.Text);

            lblMensaje.Text = mensaje;
        }