mvc页面

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

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
 编辑用户资料
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>编辑用户资料</h2>

    <%= Html.ValidationSummary("编辑失败,请重试.") %>

    <% using (Html.BeginForm())
       {%>

        <fieldset>
            <legend>用户资料</legend>
            <p>
                <label for="Name">Name:</label>
                <%= Html.Encode(Model.Name)%>
            </p>
            <p>
                <label for="Password">Password:</label>
                <%= Html.TextBox("Password", Model.Password)%>
                <%= Html.ValidationMessage("Password", "*")%>
            </p>
            <p>
                <label for="Mobile">Mobile:</label>
                <%= Html.TextBox("Mobile", Model.Mobile)%>
                <%= Html.ValidationMessage("Mobile", "*")%>
            </p>
            <p>
                <label for="Phone">Phone:</label>
                <%= Html.TextBox("Phone", Model.Phone)%>
                <%= Html.ValidationMessage("Phone", "*")%>
            </p>
            <p>
                <label for="QQ">QQ:</label>
                <%= Html.TextBox("QQ", Model.QQ)%>
                <%= Html.ValidationMessage("QQ", "*")%>
            </p>
            <p>
                <label for="Email">Email:</label>
                <%= Html.TextBox("Email", Model.Email)%>
                <%= Html.ValidationMessage("Email", "*")%>
            </p>
            <p>
                <label for="Company">Company:</label>
                <%= Html.TextBox("Company", Model.Company)%>
                <%= Html.ValidationMessage("Company", "*")%>
            </p>
            <p>
                <label for="Address">Address:</label>
                <%= Html.TextBox("Address", Model.Address)%>
                <%= Html.ValidationMessage("Address", "*")%>
            </p>
            <p>
                <input type="submit" value="编辑" />
            </p>
        </fieldset>

    <% } %>

    <div>
        <%=Html.ActionLink("返回用户列表", "Index") %>
    </div>

</asp:Content>

、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、集合类的

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

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    用户列表
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        用户列表</h2>
    <span style="color: Red;">
        <%=Html.Encode(TempData["message"]) %></span>
    <table>
        <tr>
            <th>
            </th>
            <th>
                Name
            </th>
            <th>
                Mobile
            </th>
            <th>
                Phone
            </th>
            <th>
                QQ
            </th>
            <th>
                Email
            </th>
            <th>
                Company
            </th>
            <th>
                Address
            </th>
        </tr>
        <% foreach (var item in Model)
           { %>
        <tr>
            <td>
                <%= Html.ActionLink("编辑", "Edit", new {  id=item.Id  }) %>
                |
                <%= Html.ActionLink("详细", "Details", new { id = item.Id })%>
            </td>
            <td>
                <%= Html.Encode(item.Name) %>
            </td>
            <td>
                <%= Html.Encode(item.Mobile) %>
            </td>
            <td>
                <%= Html.Encode(item.Phone) %>
            </td>
            <td>
                <%= Html.Encode(item.QQ) %>
            </td>
            <td>
                <%= Html.Encode(item.Email) %>
            </td>
            <td>
                <%= Html.Encode(item.Company) %>
            </td>
            <td>
                <%= Html.Encode(item.Address) %>
            </td>
        </tr>
        <% } %>
    </table>
</asp:Content>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值