Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

mvc6-grid MVC.Grid with Razor Pages errors out

$
0
0

I'm trying to include mvc6-grid and followed the installation but I'm not getting any specific error just Failed to load resource: net::ERR_CONNECTION_RESET.

I followed all directions under http://mvc6-grid.azurewebsites.net/Home/Installation the only difference is that in Razor Pages, there is no a Shared View folder so I added the _AjaGrid,_Grid and _Pager.cshtml under the Pages root folder. 

Here is my Entries\index.cshtml.cs

[BindProperty]
public IList<EntryLog> EntryLog { get;set; }
public TeamMember TeamMember { get; set; }
public IList<TeamMemberEntrySummary> TeamMemberEntrySummary { get; set; }

public async Task OnGetAsync(string id)
{
TeamMember = await _context.TeamMember.Include(x => x.Position).Include(p => p.Shift).FirstOrDefaultAsync(p => p.Id == id);

TeamMemberEntrySummary = _context.EntryLog.Where(x => x.TeamMemberId == id)
.Include(e => e.Reason).ToList().GroupBy(a => a.ReasonId).Select(y => new TeamMemberEntrySummary
{
EntryReason = y.First().Reason.Name,
EntryCount = y.Count()
}).ToList();

EntryLog = await _context.EntryLog.Where(x => x.TeamMemberId== id)
.Include(e => e.Reason)
.Include(e => e.ReasonType).ToListAsync();

}

And this is my Entries\index.cshtml

@page
@model WebCrewLog.Pages.Entries.IndexModel

@{
    ViewData["Title"] = "Index";
}<h2>Entries</h2><p><a asp-page="Create" asp-route-id="@Model.TeamMember.Id">Create New></a></p>

@(Html
        .Grid(Model.EntryLog)
        .Build(columns =>
        {
            columns.Add(model => model.Id).Titled("ID");
            columns.Add(model => model.EntryDate).Titled("Entry Date");


        })

    )

I'm not getting an specific error so I wonder if this just wont work? or do I need to include one of partialviews into the index.cshtml ?

Thanks,

CZ


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>