title: How to use HtmlHelper and AjaxHelper in a razor @helper?
body: <p>I want to create a helper:</p>
  
  <pre><code>@using System.Web.Mvc
  @using System.Web.Mvc.Ajax
  @using System.Web.Mvc.Html
  @using System.Web.Routing
  @using Proj.Extenders
  @using Proj.Web.Mvc
  @using Proj.Web.Mvc.Paging
  @using Proj.Mvc.Helpers
  @using Proj.Mvc
  
  @helper Create(dynamic ajaxHelper, dynamic htmlHelper,
      string text,
      string targetID,
      string actionName,
      string controllerName,
      object routeValues,
      string active)
  {
      &lt;li@{ if (active == targetID) { &lt;text&gt; class="active"&lt;/text&gt; } }&gt;
          @ajaxHelper.ActionLink(htmlHelper.Resource(text).ToString(),
              actionName, controllerName, routeValues, updateTargetId: targetID)
      &lt;/li&gt;
  }
  </code></pre>
  
  <p>The problem is that I have extension methods on the <code>HtmlHelper&lt;T&gt;</code> where <code>T</code> is the type of the model. I want to use the same helper for several views, but the <code>@model</code> on the views will be different.</p>
  
  <p>It is not finding the extension method:</p>
  
  <pre><code>'System.Web.Mvc.AjaxHelper&lt;X&gt;' does not contain a definition for 'ActionLink'
  </code></pre>
  
  <p><code>ActionLink</code> method</p>
  
  <pre><code>public static MvcHtmlString ActionLink&lt;T&gt;(this AjaxHelper&lt;T&gt; ajax,
      string linkText = " ",
      string actionName = null, string controllerName = null,
      object routeValues = null, object htmlAttributes = null,
      string confirm = null,
      string httpMethod = null,
      InsertionMode insertionMode = InsertionMode.Replace,
      int loadingElementDuration = 0,
      string loadingElementId = null,
      string onBegin = null,
      string onComplete = null,
      string onFailure = null,
      string onSuccess = null,
      string updateTargetId = null,
      string url = null)
  {
      var options = GetAjaxOptions(confirm, httpMethod, insertionMode, loadingElementDuration,
          loadingElementId, onBegin, onComplete, onFailure, onSuccess, updateTargetId, url);
  
      return ajax.ActionLink(linkText, actionName, controllerName, routeValues, options, htmlAttributes);
  }
  </code></pre>
  
  <p>The file is located at</p>
  
  <pre><code>- Website
    - App_Code
       TabHelper.cshtml
  </code></pre>
  
  <p>How can I use <code>HtmlHelper&lt;T&gt;</code> and <code>AjaxHelper&lt;T&gt;</code> methods on the helper file?</p>