How to get currently executing view name or partial view name programmatically inside a HtmlHelper extension? In my situation, I can't use ViewData or can't pass view name to the extension from the View.
var webPage = htmlhelper.ViewDataContainer as WebPageBase;
var virtualPath = webPage.VirtualPath;
This is your best bet:
Retrieve the current view name in ASP.NET MVC?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With