开发者

Can't find Html.TextBox

I am trying to get an old application that was written using a mvc preview version and have run in the following problem.

开发者_如何学运维
<%=  Html.TextBox("Register_Name", ViewData.Model.Register.Name, 20, 30, new { _class = "textInput username" })%>

This is the error i get:

'System.Web.Mvc.HtmlHelper' does not contain a definition for 'TextBox' and no extension method 'TextBox' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)

My question is how do I resolve this? The problem also occurs with the "Html.Password" field.


do you have in start of the page where do you want to use it

<%@ Page .....    Inherits="System.Web.Mvc.ViewPage"%>


In your web.config, make sure you have the following:

    <compilation>
        <assemblies>
            <add assembly = "System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </assemblies>
    </compilation>

    <pages>
        <namespaces>
            <add namespace = "System.Web.Mvc" />
            <add namespace = "System.Web.Mvc.Html" />
        </namespaces>
    </pages>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜