close

1) Server

@{
    ViewBag.Title = "ContactForm";
}

<h2>Contact Info</h2>

@using (Html.BeginForm())
{
    @Html.Label("Name")
    @Html.TextBox("Name")
    @Html.ValidationMessage("Name")
    <br />
    @Html.Label("Email")
    @Html.TextBox("Email")
    @Html.ValidationMessage("Email")
    <br />
    @Html.Label("Comments")
    @Html.TextBox("Comments")
    @Html.ValidationMessage("Comments")
    <br />
   
    <button type="submit">Submit</button>
}

 

2) Client

@model test2.Models.ContactModel
@{

    ViewBag.Title = "ContactForm";
}

<h2>@ViewBag.Message</h2>

@using (Html.BeginForm())
{
    @Html.LabelFor(model=> model.Name)
    @Html.TextBoxFor(model=> model.Name)
    @Html.ValidationMessageFor(model=> model.Name)
    <br />
    @Html.LabelFor(model=> model.Email)
    @Html.TextBoxFor(model=> model.Email)
    @Html.ValidationMessageFor(model=> model.Email)
    <br />
    @Html.LabelFor(model=> model.Email)
    @Html.TextBoxFor(model=> model.Email)
    @Html.ValidationMessageFor(model=> model.Email)
    <br />
   
    <button type="submit">Submit</button>
}

 

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 chilliwack425 的頭像
    chilliwack425

    無聊的部落格

    chilliwack425 發表在 痞客邦 留言(0) 人氣()