asp.net mvc 4 - Can't get ViewContext.RouteData.Values["Controller"] to work for me -


I'm doing something wrong, I know so much :) I'm trying to display a simple breadcrumb on one page I am I have it in a scene:

  @if (view context.RootData value ["action"]. Toaster () == "index") {& lt; Li & gt; // This "Mater" @ View Contex RootData displays value ["Controller"] & lt; / Li & gt; } Other {& lt; Li & gt; // It shows a hyperlink "Mater", //, but Href "MyApp / Matter / Matter" & lt; A href = "@ ViewContext.RouteData.Values ​​[" Controller "]. ToString ()" & gt; @ViewContax Root data Value ["controller"] & lt; / A & gt; & Lt; / Li & gt; }   

In the above scenario, I have my root C file set to be "MyApp / Matter" which corresponds to an "index" verb on "MeterController". When clicking on the link

you are brought to "my app / mater / mater" which does not work.

How can I work it out?

You are setting a relative path in the anchor tag. The rating is as follows:

  & lt; A href = "substance" & gt; Substance & lt; / A & gt;   

She (current) gets attached to your current URL, in this case, I can only consider "MyApp / Matter" as a result of "My App / Mater / Matter"

You have to specify a complete URL or more complete relative URL - .. / METER will work in this case.

Besides, I can not help you understand what you are trying to do, something else about it.

  1. Do you want them to take the edges of bread? What is the breadcrumbs in relation to what they are seeing?
  2. Does your app have a directory in your app that contains an app or is it an area within your app?
  3. I can only collect that substance controller, but what is the action? If you are seeing a link, then it is not currently considering index action.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -