here is the problem
public ActionResult One()
{
if(condition)
return View()
else
return Two()
}
public ActionResult Two()
{
return View()
}
how can I do that without error
Change your code to:
public ActionResult One()
{
if(condition)
return View();
else
RedirectToAction("Two");
}
public ActionResult Two()
{
return View();
}
只需按名称return view("nameOfView")
( return view("nameOfView")
),或使用RedirectToAction
或RedirectToRoute
Simply use:
public ActionResult One()
{
if(condition)
return View()
else
return View("Two")
}
oh I've solved the problem
public ActionResult Two()
{
return View("Two")
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.