Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Apparently there is not support for this in the futures project at this time, or they changed it since Futures v1.0. I used reflector to disassemble the futures library and found the source for the RenderAction method and modified it to parse the area out of the Controller's namespace and add it into the RouteValues before it processes. I'm assuming that I'll likely have to do something similar for ActionLink's as well if I want them to behave in the same way.</p> <p>Here is a sample of the code that I used, so hopefully this can help someone else in the future. I will likely create new methods indicating that it will parse the areas, rather than an overload as I have thus far</p> <pre><code>public static void RenderAction&lt;TController&gt;(this HtmlHelper helper, Expression&lt;Action&lt;TController&gt;&gt; action) where TController : Controller { var ctrlNamespace = typeof(TController).Namespace; int areaStart = ctrlNamespace.IndexOf(".Areas."); if (areaStart &gt; -1) { ctrlNamespace = ctrlNamespace.Substring(areaStart + 7); int areaEnd = ctrlNamespace.IndexOf("."); ctrlNamespace = ctrlNamespace.Substring(0, areaEnd); } else { ctrlNamespace = String.Empty; //default area } helper.ViewContext.RouteData.Values.Add("area", ctrlNamespace); RouteValueDictionary routeValuesFromExpression = ExpressionHelper.GetRouteValuesFromExpression&lt;TController&gt;(action); foreach (KeyValuePair&lt;string, object&gt; pair in helper.ViewContext.RouteData.Values) { if (!routeValuesFromExpression.ContainsKey(pair.Key)) { routeValuesFromExpression.Add(pair.Key, pair.Value); } } helper.RenderRoute(routeValuesFromExpression); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload