Exemplo n.º 1
0
    protected void GvCategoria_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            //Session["envioslide"] = "editar";
            GridViewRow row          = GvCategoria.SelectedRow;
            string      Id_Categoria = "";
            HiddenField cod          = default(HiddenField);
            cod          = (HiddenField)row.FindControl("Id_Categoria");
            Id_Categoria = cod.Value;
            ServicioCom21.ServicioCom21 _administrador = new ServicioCom21.ServicioCom21();
            DataSet ds = _administrador.Com21_consulta_categoria_id(int.Parse(Id_Categoria));
            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    //seteo todos los valores de la consulta especifica
                    this.hfIdcategoria.Value = dr[0].ToString();
                    Session["hfIdcategoria"] = dr[0].ToString();
                    this.txtcategoria.Text   = dr[1].ToString();
                    //if (dr["Ruta"].ToString() == "")
                    //{
                    //    this.img.ImageUrl = "~/images/SIN_IMAGEN_CATSUB.png";
                    //}
                    //else
                    //{
                    //    this.img.ImageUrl = dr["Ruta"].ToString();
                    //}

                    if (Convert.ToBoolean(dr[2].ToString()) == true)
                    {
                        cbactivar.Checked = true;
                    }
                    else
                    {
                        cbactivar.Checked = false;
                    }
                }
                btnedit.Visible   = true;
                btninsert.Visible = false;
            }
        }
        catch (Exception Ex)
        {
            Console.WriteLine(Ex.Message);
            ScriptManager.RegisterStartupScript(upMantenimiento, upMantenimiento.GetType(), "click", "alert('Error Tecnico por favor espere unos minutos');", true);
        }
    }
Exemplo n.º 2
0
 private void cargarCat()
 {
     ServicioCom21.ServicioCom21 _consultar = new ServicioCom21.ServicioCom21();
     if (Request.QueryString["Cat"] != null)
     {
         string  subcat = Request.QueryString["Cat"].ToString();
         DataSet _sub   = _consultar.Com21_consulta_categoria_id(int.Parse(subcat));
         if (_sub.Tables[1].Rows.Count > 0)
         {
             foreach (DataRow r in _sub.Tables[1].Rows)
             {
                 lbltitulo.Text = r["Categoria"].ToString();
             }
         }
     }
 }