Reputation: 8133
The RenderAction is working just fine but as soon as I surround it with a if statement I get a compile error:
@if (@Model.IsConfigurationAllow)
{
@{ Html.RenderAction("Save"); } // CS1501: No overload for method 'Write' takes 0 arguments
}
More general question where can I found the grammar for the Razor view syntax?
Upvotes: 2
Views: 765
Reputation: 32758
Did you try this?
@if (@Model.IsConfigurationAllow)
{
<text>@{ Html.RenderAction("Save"); }</text>
}
Upvotes: 1
Reputation: 16032
Html.RenderAction
renders the HTML directly into the response, so you cant call it in a code block.
The counterpart Html.Action
returns a string with the results.
See http://haacked.com/archive/2009/11/17/aspnetmvc2-render-action.aspx
Upvotes: 3