Sandeep Shekhawat

Sandeep Shekhawat

  • NA
  • 855
  • 902.8k

System.Web.Mvc.HtmlHelper error?

Jun 7 2011 11:14 PM
I have a modal GuestResponse  like:

namespace MyMvcApp.Models
{   
    public class GuestResponse
    {
        public string Name { get; set; }
        public string Email { get; set; }
        public string Phone { get; set; }
        public bool? WillAttend { get; set; }
 
    }
}

I have create strongly-typed view:
 and add View Data Class
MyMvcApp.Models.GuestResponse

in the view i have like this:
<% using(Html.BeginForm()) { %>
<p>Your name: <%= Html.TextBoxFor(x => x.Name) %></p>

and here i get a error like:
Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper<MyMvcApp.Models.GuestResponse>' does not contain a definition for 'TextBoxFor' and no extension method 'TextBoxFor' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<MyMvcApp.Models.GuestResponse>' could be found (are you missing a using directive or an assembly reference?)


Line 9:  <h1>RSVP</h1>
Line 10: <% using(Html.BeginForm()) { %>
Line 11: <p>Your name: <%= Html.TextBoxFor(x => x.Name) %></p>
Line 12: <p>Your email: <%= Html.TextBoxFor(x => x.Email) %></p>
Line 13: <p>Your phone: <%= Html.TextBoxFor(x => x.Phone) %></p>


How can solve this Please help me? where i am wrong.