Reputation:
I'm Trying to Overload an ActionResult in MVC(4) so that It can return the same view.
[ValidateInput(false)]
public ActionResult SearchQuery(string SearchTerm, bool isAdvanced = false)
{
return View(new SearchViewModel(SearchTerm, 50, 0, -1, false, 0, null, isAdvanced));
}
[ActionName("BatchSearchQuery")]
[ValidateInput(false)]
public ActionResult SearchQuery(SearchViewModel SVM)
{
return View(SVM);
}
However when I Call the BatchSearchQuery it returns an error "The view 'BatchSearchQuery' or its master was not found or no view engine supports the searched locations."
Does Anybody Know How I could Return the Correct View from here?
Upvotes: 0
Views: 573
Reputation: 1039438
You can specify the view name when rendering it:
[ActionName("BatchSearchQuery")]
[ValidateInput(false)]
public ActionResult SearchQuery(SearchViewModel SVM)
{
return View("SearchQuery", SVM);
}
Upvotes: 1