Razor form asp.net mvc
<pre><code>&lt;% using (Html.BeginForm("DisplayCustomer","Customer",FormMethod.Post))
{ %&gt;
Enter customer id :- &lt;%= Html.TextBox("Id",Model)%&gt; &lt;br /&gt;
Enter customer code :- &lt;%= Html.TextBox("CustomerCode",Model) %&gt;&lt;br /&gt;
Enter customer Amount :- &lt;%= Html.TextBox("Amount",Model) %&gt;&lt;br /&gt;
&lt;input type="submit" value="Submit customer data" /&gt;
&lt;%} %&gt;
</code></pre>

<hr>

<p>Using Razor</p>

<pre><code>    @using (Html.BeginForm("DisplayResult", "DisplayCustomer", FormMethod.Post)) { 
    @Html.ValidationSummary(true);

    @:Enter customer id :- @Html.TextBox("Id",Model)
    @:Enter customer code :-@Html.TextBox("Code",Model)
    @:Enter customer Amount :-@Html.TextBox("Amount",Model)
    &lt;input type="submit" value="Enter the value" /&gt;

} 
</code></pre>

<p><strong>Compiler Error Message: CS1973:</strong> 'System.Web.Mvc.HtmlHelper' has no applicable method named 'TextBox' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.</p>

<pre><code>@using (Html.BeginForm("DisplayResult", "DisplayCustomer", FormMethod.Post)) { 
    @Html.ValidationSummary(true);

    @:Enter customer id :- &lt;input type="text" name="Id" /&gt;
    @:Enter customer code :-&lt;input type="text" name="Code" /&gt;
    @:Enter customer Amount :-&lt;input type="text" name="Amount" /&gt;
    &lt;input type="submit" value="Enter the value" /&gt;

}
</code></pre>

<p>This works correctly</p>

<p>What am I doing wrong .I am trying to use the razor equivalent of the code given in first section.The second part is the razor code attempt  and third works when only form is used  .I also want to know if nest is the reason the error is happening </p>

<p><strong>EDIT:-</strong></p>

<pre><code>  @:Enter customer id :- @Html.TextBox("Id")
  @:Enter customer code :-@Html.TextBox("Code")
  @:Enter customer Amount :-@Html.TextBox("Amount")
</code></pre>

<p>If I do not use model then everything works perfectly</p>

<h2>Controller</h2>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication1.Models;

namespace MvcApplication1.Controllers
{
    public class DisplayCustomerController : Controller
    {
        //
        // GET: /DisplayCustomer/
        [HttpPost]
        public ViewResult DisplayResult()
        {
            Customer objCustomer = new Customer();
            objCustomer.Id = Convert.ToInt16(Request.Form["Id"].ToString());  //101; 
            objCustomer.Amount =Convert.ToDouble(Request.Form["Amount"].ToString());// 80.00;
            objCustomer.Code = Request.Form["Code"].ToString();//"IE100"; 

            return View("DisplayResult", objCustomer);
        }
        public ActionResult ShowForm() 
        {

            return View("ShowForm");
        }

    }
}
</code></pre>

<h2>Model</h2>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MvcApplication1.Models
{
    public class Customer
    {
        //private string Code;
      //  private int Id;
        //private double Amount;
        public String Code
        {
            get;
            set;
        }
        public int Id
        {
            get;
            set;
        }
        public double Amount
        {
            get;
            set;
        }

    }
}
</code></pre>

<h2>View(ShowForm)</h2>

<pre><code>@{
    ViewBag.Title = "ShowForm";
}

&lt;h2&gt;ShowForm&lt;/h2&gt;

@using (Html.BeginForm("DisplayResult", "DisplayCustomer", FormMethod.Post)) { 
    @Html.ValidationSummary(true);

    @:Enter customer id :- @Html.TextBox("Id")
    @:Enter customer code :-@Html.TextBox("Code")
    @:Enter customer Amount :-@Html.TextBox("Amount")
    &lt;input type="submit" value="Submit" /&gt;

}
</code></pre>