從ASP.NET MVC Preview 3開始,不再支持HTML.Button(和其他相關的HTML控件)。ASP.NET MVC中的HTML.Button
問題是,他們有什麼等價物?我有一個使用Preview 2構建的應用程序,現在我必須使其與最新的CTP版本兼容。
從ASP.NET MVC Preview 3開始,不再支持HTML.Button(和其他相關的HTML控件)。ASP.NET MVC中的HTML.Button
問題是,他們有什麼等價物?我有一個使用Preview 2構建的應用程序,現在我必須使其與最新的CTP版本兼容。
我明白了。它是這樣的:
<form method="post" action="<%= Html.AttributeEncode(Url.Action("CastUpVote")) %>">
<input type="submit" value="<%=ViewData.Model.UpVotes%> up votes" />
</form>
謝謝大家的幫助!
只需在您的html中寫入< input type =「button」... />。 html控件沒有什麼特別之處。
看看http://stackoverflow.com/questions/407770/mapping-individual-buttons-on-asp-net-mvc-view-to-controller-actions – 2010-03-24 00:13:15
是與HTML.Button等效的ASP.NET。它會默認生成<input type="button">
。 (這是System.Web.UI.WebControls.Button類)
沒有用,問題是關於ASP.NET MVC ,而不是Web窗體。 – 2011-07-09 16:06:43
幾個擴展方法被移到了Microsoft.Web.Mvc,它是MVC Futures DLL。你可能想看看那些失蹤的東西。
你不需要使用Razor。 –
PositiveGuy
2012-03-30 05:58:53