Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望 ASP.NET MVC4 中的 1 个动作有 2 个以上的视图,这样我就可以基于动作我不想创建另一个动作,因为粗糙值会改变
条件基于动态值
您可以在操作结果的返回中指定视图名称:
public ActionResult YourAction() { if(yourCondition) return View("View1Name"); else return View("View2Name"); }