2012-08-08 9 views
9

El navegador muestra "System.Web.Mvc.Html.MvcForm" junto a mi formulario. ¿Cómo puedo ocultarlo? Aquí está el código del formulario.obtuvo "System.Web.Mvc.Html.MvcForm" en la página

@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" /> 
    } 

Respuesta

32

cambiar el código para (Añadir el @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" /> 
} 
4

Cambie la línea @Html.BeginForm("NewComment", "Difficultes", FormMethod.Post) a @using(Html.BeginForm("NewComment", "Difficultes", FormMethod.Post))

Cuestiones relacionadas