the problem I am having is that I cannot create a WebGrid on the view, but I can in the controller. I have tried added System.Web.Helpers in the Views\web.config with no luck. What am I doing wrong?
Here is my view:
@model C2GoWebMvcPrototype.WebUI.Models.ActiveAssessmentsViewModel
@{ ViewBag.Title = "All Active Assessments"; }
<h2>All Active Assessments</h2>
@{
var grid = new WebGrid(Model.ActiveAssessments);
}
@grid.GetHtml()
Here is the model:
public class ActiveAssessmentsViewModel
{
public WebGrid Grid { get; set; }
public IEnumerable<AsmtSummary> ActiveAssessments { get; set; }
}
And here is the Action:
public ActionResult List()
{
var activeAssessments = _repository.GetActiveAsmt();
var model = new ActiveAssessmentsViewModel
{
Grid = new WebGrid(activeAssessments),
ActiveAssessments = activeAssessments
};
return View(model);
}
ehcarleton
Member
33 Points
46 Posts
How to resolve error message "The resource cannot be found" when using WebGrid
May 16, 2012 09:30 PM|LINK
the problem I am having is that I cannot create a WebGrid on the view, but I can in the controller. I have tried added System.Web.Helpers in the Views\web.config with no luck. What am I doing wrong?
Here is my view:
@model C2GoWebMvcPrototype.WebUI.Models.ActiveAssessmentsViewModel @{ ViewBag.Title = "All Active Assessments"; } <h2>All Active Assessments</h2> @{ var grid = new WebGrid(Model.ActiveAssessments); } @grid.GetHtml()Here is the model:
public class ActiveAssessmentsViewModel { public WebGrid Grid { get; set; } public IEnumerable<AsmtSummary> ActiveAssessments { get; set; } }And here is the Action:
public ActionResult List() { var activeAssessments = _repository.GetActiveAsmt(); var model = new ActiveAssessmentsViewModel { Grid = new WebGrid(activeAssessments), ActiveAssessments = activeAssessments }; return View(model); }Dino He - MS...
Star
8068 Points
1023 Posts
Microsoft
Re: How to resolve error message "The resource cannot be found" when using WebGrid
May 18, 2012 06:53 AM|LINK
Hi
Are your using MVC ?
Please refer to:
Get the Most out of WebGrid in ASP.NET MVC
Hope it helpful.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
ehcarleton
Member
33 Points
46 Posts
Re: How to resolve error message "The resource cannot be found" when using WebGrid
May 18, 2012 07:13 AM|LINK