1

I have an page where I create a form like

@{
    ViewBag.Title = "Login";
}

@Styles.Render("~/bundles/login/css")

@Html.BeginForm("Index", "Login", null)
{
    // Normal HTML content that constructs the form.
}

The form works as expected and is redirecting to the specified controller when submitted, but the following unwanted text is displayed at the top of the page,

System.Web.Mvc.Html.MvcForm {}

I can't figure out why this text would be displayed. Any ideas?

Jämes
  • 6,945
  • 4
  • 40
  • 56
Andre Lombaard
  • 6,985
  • 13
  • 55
  • 96
  • 1
    Possible duplicate http://stackoverflow.com/questions/4975354/html-beginform-displaying-system-web-mvc-html-mvcform-on-page – Farax Sep 25 '13 at 07:15

2 Answers2

2

You should use

@using(Html.BeginForm("Index", "Login", null))
{
//Code here 
}

or Else use

Html.EndForm for complimenting the Html.Beginform

bizzehdee
  • 20,289
  • 11
  • 46
  • 76
Farax
  • 1,447
  • 3
  • 20
  • 37
2
@{
ViewBag.Title = "Login";
}

@Styles.Render("~/bundles/login/css")

@using(Html.BeginForm("Index", "Login", null))
{
 // Normal HTML content that constructs the form.
}
Soner Sevinc
  • 400
  • 4
  • 19