View Single Post
  #33 (permalink)  
Old June 14th, 2010, 01:53 PM
ulikkg ulikkg is offline
Registered User
Join Date: May 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default error in HTML.IF

I want to use membership part in another project. When I followed this chapter in TheBeerHouse project I did not face but in this new project I am facing. Could somebody please help?

I created Register method inside UserController. Then without doing other Logi, ManageUsers etc methods I continued with Register View. When I run application I am getting following error:

Compiler Error Message: CS1061:
'System.Web.Mvc.HtmlHelper<object>' does not contain a definition for 'If' and no extension method 'If' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<object>' could be found (are you missing a using directive or an assembly reference?)


Line 13: <form method = "post" action = "<%= Url.Action("Register", "User") %>"
Line 14: <input type="hidden" name="returnUrl" value="<%= Html.If(!String.IsNullOrEmpty(Request.QueryString["returnUrl"]), () => Request.QueryString["returnUrl"])
Line 15: .ElseIf(Request.UrlReferrer != null, () => Request.UrlReferrer.ToString())
Line 16: .Else(() => String.Empty) %>"/>

Please help.