1

I am getting text appearing in my view and I can't figure out what is causing it. My code example below has been edited to only show the area that is somehow creating the issue. I can include more code if necessary.

The text didn't appear until I added my BeginForm code. enter image description here

 @foreach (var item in Model.orderList)
            {
                <tr>
                    @Html.HiddenFor(modelItem => item.prod_order_details.UID)

                    <td>
                        @if (item.prod_order_details.status.Contains("Assigned"))
                        {

                            @(Html.BeginForm("Details_PO_Screen", "ProdOrder",  new {po_id = @item.prod_order_details.UID }))
                            {
                                <input id="submitForm" class="btn btn-sm" style="background-color:green; color:white" disabled type="submit" value="Begin" />
                                <input id="employeelist" type="hidden" class="bacon" value="" name="employeelist">
                            }
                        }
                        else
                        {
                            @Html.DisplayFor(modelItem => item.prod_order_details.status)
                        }
                    </td>

                </tr>
            }
Kram_Koorbse
  • 442
  • 5
  • 19
  • 2
    I dont think you need the @(Html - try removing the @ – Steve Mar 08 '18 at 17:52
  • Besides the unnecessary `@`, you should use [`using` or close the form with `.EndForm()`](https://stackoverflow.com/questions/14935707/asp-net-mvc-razor-html-beginform-using-statement). – Jasen Mar 08 '18 at 18:15

1 Answers1

2

Steve comment solve your problem, just Remove the '@' sign from this line '@(Html.BeginForm("Details_PO_Screen", "ProdOrder", new {po_id = ...'

and put 'using' keyword instead.. 'using(Html.BeginForm("Details_PO_Screen", "ProdOrder", new {po_id = ...'

No need for it since you already entered code mode with '@' switch just before if statement ..

check this question too; its resolve slimier issue @Html.BeginForm Displaying "System.Web.Mvc.Html.MvcForm" on Page

There is a nice blog post about Razor syntax too.. https://weblogs.asp.net/scottgu/asp-net-mvc-3-razor-s-and-lt-text-gt-syntax

Good Luck!