2012-08-08 14 views
9

Przeglądarka wyświetla obok mojego formularza "System.Web.Mvc.Html.MvcForm". Jak mogę to ukryć? Oto kod formularza.otrzymano "System.Web.Mvc.Html.MvcForm" na stronie

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

Odpowiedz

32

zmiany kodu do (dodaj @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

zmienić linię @Html.BeginForm("NewComment", "Difficultes", FormMethod.Post) do @using(Html.BeginForm("NewComment", "Difficultes", FormMethod.Post))