Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

got "System.Web.Mvc.Html.MvcForm" on page

The browser is displaying "System.Web.Mvc.Html.MvcForm" next to my form. How can I hide it? Here is the form code.

 @Html.BeginForm("NewComment", "Difficultes", FormMethod.Post)
    {        
    @Html.HiddenFor(m => m.diff.id_diff) 
        <table>
            <tr><label><b>Nouveau commentaire</b></label></tr>
            <tr>
            <td><b>Nom :</b></td><td>@Html.TextBoxFor(m=>m.pseudo)</td>
            </tr>
            <tr>
            <td><b>Commentaire :</b></td><td>@Html.TextAreaFor(m=>m.nouveau)</td>
            </tr>
        </table>

        <input type="submit" value="Ajouter" />
    }
like image 437
Kira Avatar asked Aug 08 '12 08:08

Kira


2 Answers

Change your code to (Add the @using):

@using (Html.BeginForm("NewComment", "Difficultes", FormMethod.Post))
{        
    @Html.HiddenFor(m => m.diff.id_diff) 
    <table>
        <tr><label><b>Nouveau commentaire</b></label></tr>
        <tr>
        <td><b>Nom :</b></td><td>@Html.TextBoxFor(m=>m.pseudo)</td>
        </tr>
        <tr>
        <td><b>Commentaire :</b></td><td>@Html.TextAreaFor(m=>m.nouveau)</td>
        </tr>
    </table>

    <input type="submit" value="Ajouter" />
}
like image 158
Hadas Avatar answered Sep 26 '22 02:09

Hadas


Change the line @Html.BeginForm("NewComment", "Difficultes", FormMethod.Post) to @using(Html.BeginForm("NewComment", "Difficultes", FormMethod.Post))

like image 44
Prafulla Avatar answered Sep 22 '22 02:09

Prafulla