public void FilllListStudent() { int id = int.Parse(Request.QueryString["Id"].ToString()); var student = (from j in km.StudentsInActivities join ee in km.Students on j.StudentId equals ee.IdentityNumber where j.ActiviteId == id select new { ee.Name, j.StudentId, j.ActiviteId //Name = (from d in km.Students where d.IdentityNumber == j.StudentId select d.Name).FirstOrDefault() }).ToList(); LstStudent.DataSource = student; LstStudent.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["Id"] != null) { FilllListStudent(); int activeid = int.Parse(Request.QueryString["Id"].ToString()); var ta = (from k in km.StudentActivities where k.Id == activeid select k).FirstOrDefault(); txtFrom.Text = MyDate.getDate(ta.DateFrom.ToString()); txtTo.Text = MyDate.getDate(ta.DateTo.ToString()); txtActivity.Text = ta.Activity; txtFieldName.Text = ta.FieldName; txtSeat.Text = ta.Seat; } LstStudent.DataBind(); } }