I came across a situation in which I needed the MVC Webgrid on my page, but only after I retrieved the criteria to do a search. Having a LIST
In the end, there was a simple fix. All I had to do was check first to see if the data was null with an if block:
@{
var grid = new WebGrid(Model.Users,
canSort: false);
}
and then:
@if (Model.Users != null)
{
@grid.GetHtml(//finish grid here)
}
All Things DotNet Discussed – Winforms/ASP.Net/SharePoint/WPF
Leave a reply
You must be logged in to post a comment.