开发者

ActionLink helper problem

开发者 https://www.devze.com 2022-12-17 09:58 出处:网络
I am trying to get through Rob Conery tutorial MVC StoreFront ans I have a problem with a line of code which is a link to a controller action.

I am trying to get through Rob Conery tutorial MVC StoreFront ans I have a problem with a line of code which is a link to a controller action.

<div class="categoryNavigation">
    <% foreach (Category parent in ViewData.Model)
       { %>
       <h3><%=parent.Name%></h3>
       <ul>
            <%foreach (Category child in parent.SubCategories)
              { %>
            <li>
                <%=Html.ActionLink<CatalogController>(x=>x.Index(parent.Name,child.Name),child.Name) %>
            </li>
               <% } %>
       </ul>
        <% } %>

</div>

I get a message like that : The non generic method 'System.Web.MVC.Ajax.AjaxExtensions.ActionLink(System.Web.Mvc.AjaxHelper,string,string,System.Web.Mvc.Ajax.AjaxOptions)' cannot be used with type arguments

Could you开发者_Go百科 help me on that problem

Thanks

I think I have found something :

On his tutorial for the Html.Action helper code, I can see on intellisense the he's got two choices for this method :

Html.ActionLink Html.ActionLink<>

I don't have the Html.ActionLink<> choice on mine...

on my Web config file for the pages configuration I have the following :

<pages>
        <controls>
            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </controls>
        <namespaces>
            <add namespace="System.Web.Mvc"/>
            <add namespace="System.Web.Mvc.Ajax"/>
            <add namespace="System.Web.Mvc.Html"/>
            <add namespace="System.Web.Routing"/>
            <add namespace="System.Linq"/>
            <add namespace="System.Collections.Generic"/>
            <add namespace="CoderForTraders.Data"/>
            <add namespace="CoderForTraders.Web.Controllers"/>
        </namespaces>
    </pages>


I just needed the Microsoft.Web.Mvc reference

0

精彩评论

暂无评论...
验证码 换一张
取 消