My controller code is like I am returning data as
public ActionResult StudentDashboard(int? page)
{
ViewBag.StudentRequest = GetData.Tables[0].AsEnumerable().Select(t => new
{
StudentRequestId = t.Field<int>("StudentRequestId"),
ClassName = t.Field<string>("ClassName"),
CreatedOn = t.Field<DateTime>("CreatedOn"),
Location = t.Field<string>("Location"),
PaymentMethod = t.Field<string>("PaymentMethod"),
}).ToList().ToPagedList(page ?? 1,1);
return View(db.StudentRequests.Where(x => x.RegistrationId == registrationid).ToList().ToPagedList(page ?? 1, 3));
}
Also how can I add inner join as class table in this code?
db.StudentRequests.Where(x => x.RegistrationId == registrationid)
.ToList()
.ToPagedList(page ?? 1, 3)
and on view side I have written code as
@using PagedList;
@using PagedList.Mvc;
@model IPagedList<Student_Tutor.Models.StudentRequest>
@if (ViewBag.StudentRequest != null)
{
var StudentRequestId = (int)Model.First().StudentRequestId;// Here I am able to get the StudentRequestId
var StudentRequestTimecount = StudentRequestTime.Where(d => d.StudentRequestId == StudentRequestId).ToList();
var TutorStudentRequestcount = TutorStudentRequest.Where(d => d.StudentRequestId == StudentRequestId).ToList();
@Html.LabelFor(model => model.First().StudentRequestId)// here only text is displaying as StudentRequestId
@Html.DisplayNameFor(Model => Model.First().CreatedOn)//here only text is diplaying as created on
}
How can I get StudentRequestId
record instead of only text at
@Html.LabelFor(model => model.First().StudentRequestId)
Through this code I am not able to get the Id number of StudentRequestId
instead of number the view side is showing only text.
Please see this screenshot: