Get ControllerName and ActionName in Master Page in MVC?

sam
sam
Member
378 Points
48 Posts

Hi,

How to get ControllerName and ActionName in Master Page in MVC?

Views: 9444
Total Answered: 2
Total Marked As Answer: 1
Posted On: 02-Jul-2015 00:50

Share:   fb twitter linkedin
Answers
Jak
Jak
Member
858 Points
132 Posts
         

Hi sam,

use this code in view as:

<%:ViewContext.RouteData.Values["Action"]%>
<%:ViewContext.RouteData.Values["Controller"]%>
Posted On: 02-Jul-2015 05:50
Rahul Kiwitech
Rahul K...
Participant
292 Points
26 Posts
         

It's working for me.

Thanks

Posted On: 15-Jul-2016 00:18
 Log In to Chat