2

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?

3

3 Answers 3

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

I don't see why "renders the HTML directly into the response" Make a difference.
1

Did you try this?

@if (@Model.IsConfigurationAllow)
{
    <text>@{ Html.RenderAction("Save"); }</text>
}

Comments

0

There are a few below (more can be found just by googling);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.