在ASP.NET MVC的时候我的行动将不会返回任何东西我使用return new EmptyResult()
或return null
有什么不同吗?
在cshtml文件中,根据条件,返回空部分视图的最佳方法是什么?
现在我有:
@if(Model.Count() > 0)
{
loooonng partial view block of markup code
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能重新做到更接近这个看起来更干净:
@if(Model.Count() == 0)
{
render an empty partial view
}
loooonng partial view block of markup code goes here <- This will obviously get executed only if Model.Count() > 0
Run Code Online (Sandbox Code Playgroud)
提前致谢 !