I have a partial view (control) that\'s used across several view pages, and I need to pass the name of the current view back to the controller - so if there\'s e.g. validati
Easiest solution is using ViewBag.
public ActionResult Index() { ViewBag.CurrentView = "Index"; return View(); }
On the cshtml page
@{ var viewName = ViewBag.CurrentView; }
Or,
((RazorView)ViewContext.View).ViewPath