protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            List<Matricula> lstMatri = new List<Matricula>();

            if (Session["Matri"] != null)
            {
                lstMatri = ((List<Matricula>)Session["Matri"]);
            }
            
            string codigo=GridMatricula.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString();


            Matricula MatriculaEncontrada = lstMatri.SingleOrDefault(s => s.Codigo == Convert.ToInt32(codigo));

            if (e.CommandName == "Editar")
            {
                txtCodigo.Text = MatriculaEncontrada.Codigo.ToString();
                txtNombre.Text = MatriculaEncontrada.NombreEstud;
                txtValor.Text = MatriculaEncontrada.Valor.ToString();
            }

            if (e.CommandName == "Eliminar")
            {
                lstMatri.Remove(MatriculaEncontrada);

                //int indice =   lstFactu.IndexOf(factuEncontrada);
                //lstFactu.RemoveAt(indice);                
            }

            GridMatricula.DataSource = lstMatri;
            GridMatricula.DataKeyNames = new string[] { "Codigo" };
            GridMatricula.DataBind();
        }
        protected void btnModificar_Click(object sender, EventArgs e)
        {
            List<Matricula> lstMatri = new List<Matricula>();

            if (Session["Matri"] != null)
            {
                lstMatri = ((List<Matricula>)Session["Matri"]);
            }

            Matricula MatriculaEditada = lstMatri.SingleOrDefault(s => s.Codigo == Convert.ToInt32(txtCodigo.Text));
            int indice = lstMatri.IndexOf(MatriculaEditada);

            MatriculaEditada.NombreEstud = txtNombre.Text;
            MatriculaEditada.Valor = Convert.ToInt32(txtValor.Text);

            lstMatri[indice] = MatriculaEditada;

            GridMatricula.DataSource = lstMatri;
            GridMatricula.DataKeyNames = new string[] { "Codigo" };
            GridMatricula.DataBind();
        }