开发者

asp.net MVC 3 equivalent of EmptyDataText

开发者 https://www.devze.com 2023-02-12 05:09 出处:网络
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\"...

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

精彩评论

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

关注公众号