tags:

views:

45

answers:

1

Hi All,

As i understand asp.net mvc 2 allows use to invoke an action directly without mvc futures. so instaed of:

<%Html.RenderAction

we can use:

 <%Html.Action

I'm using an Helper class to invoke the action but inside the helper class i cannot find the .Action attirbute:

    public static void CatalogList(this HtmlHelper helper, string text)
{
    helper.ac 
}

there is no Action, but it work inline in the aspx file:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>Category</h2>
<%Html.Action( %>

not sure what i'm doing wrong, i really like the call to be in the helper and not inline.

Thanks

A: 

You just need to add a using directive for the right namespace: "System.Web.Mvc.Html".

Html.RenderAction() is included in asp.net mvc 2 as well. The only difference between RenderAction() and Action() is that Action() returns the rendered action as a string while RenderAction() renders the action directly to the output.

Mattias Jakobsson