In MVC3, I am trying to:
return View(myitems.ToList());
If I am returning an empty list, I would like to display, "Items not fo开发者_JAVA百科und"... is there an equivalent EmptyDataText as in asp.net forms?
Thank you in advance~
In your view you could test the model and act accordingly:
@if (Model.Count > 0)
{
@Html.DisplayForModel()
}
else
{
<div>Items not found</div>
}
精彩评论