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_catserv_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;
                pMensajesAlertas.Visible = false;
                PMensajeSi.Visible       = false;
                // DMensaje.Visible = false;
            }
        }
        catch (Exception Ex)
        {
            Console.WriteLine(Ex.Message);
            ScriptManager.RegisterStartupScript(upMantenimiento, upMantenimiento.GetType(), "click", "alert('Error Tecnico por favor espere unos minutos');", true);
        }
    }