预定义的MVC代码如何工作 [英] How Predefined MVC code working

查看:83
本文介绍了预定义的MVC代码如何工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


hi


<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication1.Models.LogOnModel>" %>

<asp:Content ID="loginTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Log On
</asp:Content>

<asp:Content ID="loginContent" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Log On</h2>
    <p>
        Please enter your username and password. <%: Html.ActionLink("Register", "Register") %> if you don't have an account.
    </p>

    <% using (Html.BeginForm()) { %>
        <%: Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.") %>
        <div>
            <fieldset>
                <legend>Account Information</legend>

                <div class="editor-label">
                    <%: Html.LabelFor(m => m.UserName) %>
                </div>
                <div class="editor-field">
                    <%: Html.TextBoxFor(m => m.UserName) %>
                    <%: Html.ValidationMessageFor(m => m.UserName) %>
                </div>

                <div class="editor-label">
                    <%: Html.LabelFor(m => m.Password) %>
                </div>
                <div class="editor-field">
                    <%: Html.PasswordFor(m => m.Password) %>
                    <%: Html.ValidationMessageFor(m => m.Password) %>
                </div>

                <div class="editor-label">
                    <%: Html.CheckBoxFor(m => m.RememberMe) %>
                    <%: Html.LabelFor(m => m.RememberMe) %>
                </div>

                <p>
                    <input type="submit" value="Log On" />
                </p>
            </fieldset>
        </div>
    <% } %>
</asp:Content>



当我尝试创建新的MVC2应用程序时,这实际上是预定义的项目.amMVC初学者
在这里,这种编码无法理解.没有文本框,对于Button也没有单击事件.
谁能解释它是如何工作的????/
谢谢



this is actually predefined project when i try to create new MVC2 application .am MVC beginner
here this coding am not able to understand .there is no text box and also for Button no click event.
can anyone explain how it works ???/
Thanks

推荐答案

没有文本框,对于Button也没有单击事件.
那么什么是TextBoxFor,输入类型为Submit?
尊敬的朋友,您需要了解有关HtmlHelpers和MVC中的强类型视图.
我建议您参考简单的教程.
看看以下内容:
没有文本框,也适用于按钮无点击事件. [ http://aspalliance.com/1915_ASPNET_MVC_2_Strongly_Typed_Html_Helpers_ [ ^ ]

http://www.em64t.net/2010/07 /mvc-using-strongly-typed-html-helpers-in-helper/ [
there is no text box and also for Button no click event. !
then what is TextBoxFor , input type submit?
Dear friend you need to know about HtmlHelpers and Strongly typed views in MVC.
I suggest you to refer simple tutorials .
have a look at the following :
there is no text box and also for Button no click event.[^]

http://aspalliance.com/1915_ASPNET_MVC_2_Strongly_Typed_Html_Helpers_[^]

http://www.em64t.net/2010/07/mvc-using-strongly-typed-html-helpers-in-helper/[^]


这篇关于预定义的MVC代码如何工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆