在页面上找到了"System.Web.Mvc.Html.MvcForm"

Kir*_*ira 10 asp.net asp.net-mvc razor asp.net-mvc-3

浏览器在我的表单旁边显示"System.Web.Mvc.Html.MvcForm".我怎么能隐藏它?这是表单代码.

 @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" />
    }
Run Code Online (Sandbox Code Playgroud)

Had*_*das 32

将您的代码更改为(添加@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" />
}
Run Code Online (Sandbox Code Playgroud)


Pra*_*lla 5

将行更改@Html.BeginForm("NewComment", "Difficultes", FormMethod.Post)@using(Html.BeginForm("NewComment", "Difficultes", FormMethod.Post))