开发者

asp.net MVC 3 equivalent of EmptyDataText

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>
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜