开发者

Can't find Html.TextBox

开发者 https://www.devze.com 2023-03-09 18:06 出处:网络
I am trying to get an old application that was written using a mvc preview version and have run in the following problem.

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

精彩评论

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

关注公众号