protected void gvAlumnos_RowCommand(object sender, GridViewCommandEventArgs e) { string currentCommand = e.CommandName; if (currentCommand == "SelectAlum") { int currentRowIndex = Int32.Parse(e.CommandArgument.ToString()); Session["AsigModif"] = Convert.ToInt32(gvAlumnos.DataKeys[currentRowIndex].Value); datoCred.IDAlumno = Convert.ToInt32(Session["AsigModif"]); if (Session["SeleccionadosId"] == null) { Session["SeleccionadosId"] = new List <string>(); } List <string> SeleccionadosId = (List <string>)Session["SeleccionadosId"]; SeleccionadosId.Add(Convert.ToString(datoCred.IDAlumno)); Session["SeleccionadosId"] = SeleccionadosId; string Nombre = ejecCred.buscarDatoCred("NomAlumno", datoCred) + " " + (ejecCred.buscarDatoCred("ApePatAlumno", datoCred) + " " + (ejecCred.buscarDatoCred("ApeMatAlumno", datoCred))); SeleccionadosNombre.Add(Nombre); for (int i = 0; i < SeleccionadosNombre.Count; i++) { ListaMaestros.Items.Add(SeleccionadosNombre.ElementAt(i)); } string Lconvertida; string[] SQL = SeleccionadosId.ToArray(); Lconvertida = String.Join(", ", SQL); Session["Lparametro"] = (Lconvertida); lista.Text = Convert.ToString(Session["Lparametro"]); ListaMaestros.DataBind(); } }