views:

240

answers:

2

I am getting an error when I use it like this

!{Html.RenderAction("Action", "Controller")}

I had to switch to webforms view engine and replace it with

<% Html.RenderAction("Action", "Nav"); %>

to get it to work.

The error I am getting is "Cannot convert void to char"

+7  A: 
<% Html.RenderAction("Action", "Nav"); %>

is the same as

# Html.RenderAction("Action", "Nav");

in Spark syntax. {} expression expects a result to be returned and written to the stream; RenderAction does not return nothing, it writes to the stream itself. That's why you have to call it inside code block and cannot do this inside expression.

queen3
I also had to change my controller action method from returning a View to a PartialView.
CodeToGlory
+4  A: 

Web forms:
<% %> = server code
<%= %> = server code that Response.Write(x) where x == statement

Spark:
# == <% %>
${} == <%= %>

Arnis L.
Not quite, in Spark, `!{} == <%= %>`. `${}` performs HTML encoding before writing out.
RedFilter