Files
universidad-en-asp.net/Universidad/listar.aspx.cs
Daniel Cortés a96f34d0c9 Fixes
2019-12-12 15:08:38 -03:00

47 lines
1.4 KiB
C#

using DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class listar : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Entities entities = new Entities();
var participantes = from p in entities.Participantes select new {
Id = p.id,
Nombre = p.nombre,
FechaInscripcion = p.fechaInscripcion,
PGA = p.pga,
Universidad = p.carrera.universidad.nombre,
Carrera = p.carrera.nombre,
Seminario = p.seminario.nombre
};
if (participantes.Count() > 0)
{
participantes_grid.DataSource = participantes.ToList();
participantes_grid.DataBind();
}
else
{
empty_message.Text = "No hay participantes registrados";
}
}
protected void ParticipantesRowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[0].Text = "#";
e.Row.Cells[1].Text = "Nombre";
e.Row.Cells[2].Text = "Fecha de Inscripcion";
e.Row.Cells[3].Text = "PGA";
e.Row.Cells[4].Text = "Universidad";
e.Row.Cells[5].Text = "Carrera";
e.Row.Cells[6].Text = "Seminario";
}
}
}