I am trying to display a partial view using a special helper method. The only problem: I can not get through this syntax problem. The model installed for this cshtml file is a collection of IEnumerable models, which I defined as "Operation". I am sure this is easy to fix. Here is an example of what I see:
I have this code block:
@using(Html.BeginForm()) { <div id="editor_rows"> @foreach (var item in Model){ Html.RenderPartial("OperationEditorRow", item); } </div> }
This gives me the following runtime error:
Unexpected "{" after "@" character. Once inside the body of a code block (@if {}, @{}, etc.) you do not need to use "@{" to switch to code.
But if I remove the @ sign before the foreach statement, everything is interpreted as plain text. So I tried to put @ before Html like this:
@using(Html.BeginForm()) { <div id="editor_rows"> @foreach (var item in Model){ @Html.RenderPartial("OperationEditorRow", item); } </div> }
This returns with a compilation error that states:
Cannot implicitly convert type void to object
If I run the project here, I get a runtime error that reads:
The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments
I assume this is due to a previous error. If anyone has a suggestion for me, please help.
source share