Reputation: 1207
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" />
}
Upvotes: 10
Views: 8026
Reputation: 1939
Change the line @Html.BeginForm("NewComment", "Difficultes", FormMethod.Post)
to @using(Html.BeginForm("NewComment", "Difficultes", FormMethod.Post))
Upvotes: 5
Reputation: 10374
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" />
}
Upvotes: 33