私はそれらのかみそりのヘルパーが嫌いです。(LabelFor、TextboxFor...) 彼らは私を助けようとしますが、何も教えてくれません。
ASPXエンジンでやってみたい。私がそれを開くと、左側にすべての古い良いhtmlコマンドを含むツールボックスさえあります。なぜ私はそれを使用できないのですか?
アプリの intellisense をビルドしようとすると、MVC がそれを必要としないことがわかっているのに、runat="server" が必要であると言うのはなぜですか?
簡単に言えば、ヘルパーを使用せずに HTML を記述するにはどうすればよいですか? 建設的なアドバイスをいただければ幸いです。
サンプル:
<%@ Page Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">Home Page</asp:Content>
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
<asp:ListBox runat="server">
<asp:ListItem Text="text1" />
<asp:ListItem Text="text2" />
</asp:ListBox>
</asp:Content>
エラー:
`Server Error in '/' Application.
Control 'MainContent_ctl00' of type 'ListBox' must be placed inside a form tag with runat=server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Control 'MainContent_ctl00' of type 'ListBox' must be placed inside a form tag with runat=server.
Source Error:
Line 22: <ul id="menu">
Line 23: <li><%: Html.ActionLink("Home", "Index", "Home")%></li>
Line 24: <li><%: Html.ActionLink("About", "About", "Home")%></li>
Line 25: </ul>
Line 26: </div>`