ASP.NET MVC返回空视图 [英] ASP.NET MVC return empty view
本文介绍了ASP.NET MVC返回空视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是返回一个空的ActionResult(儿童行动),最自然的方式?
What is the most natural way to return an empty ActionResult (for child action)?
public ActionResult TestAction(bool returnValue)
{
if (!returnValue)
return View(EmptyView);
return View(RealView);
}
一种选择,我可以看到的是创建一个空的观点,并在EmptyView引用...但可能有任何内置选项?
One option I can see is to create an empty view and reference it at EmptyView... but may be there is any built-in option?
推荐答案
返回的 EmptyResult类
return new EmptyResult();
这篇关于ASP.NET MVC返回空视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文