• ASP.Net 显示


    @model IEnumerable<G6.Model.UserModel>

    @{
    Layout = null;
    }

    <!DOCTYPE html>

    <html>
    <head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    </head>
    <body>
    <p>
    <a asp-action="Create">Create New</a>
    </p>
    <table class="table">
    <thead>
    <tr>
    <th>
    @Html.DisplayNameFor(model => model.UId)
    </th>
    <th>
    @Html.DisplayNameFor(model => model.LoginName)
    </th>
    <th>
    @Html.DisplayNameFor(model => model.LoginPwd)
    </th>
    <th>
    @Html.DisplayNameFor(model => model.UName)
    </th>
    <th></th>
    </tr>
    </thead>
    <tbody>
    @foreach (var item in Model) {
    <tr>
    <td>
    @Html.DisplayFor(modelItem => item.UId)
    </td>
    <td>
    @Html.DisplayFor(modelItem => item.LoginName)
    </td>
    <td>
    @Html.DisplayFor(modelItem => item.LoginPwd)
    </td>
    <td>
    @Html.DisplayFor(modelItem => item.UName)
    </td>
    <td>
    @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
    @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
    @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
    </td>
    </tr>
    }
    </tbody>
    </table>
    </body>
    </html>

    ADD


    @{
    Layout = null;
    }

    <!DOCTYPE html>

    <html>
    <head>
    <meta name="viewport" content="width=device-width" />
    <title>AddUser</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <script src="~/lib/jquery/dist/jquery.js"></script>
    <script>
    function AddUser() {
    var obj = {
    LoginName: $("#txt_loginName").val(),
    LoginPwd: $("#txt_loginPwd").val(),
    UName: $("#txt_Name").val()
    };
    $.ajax({
    url: "/User/AddUser",
    type: "post",
    dataType: "json",
    data: obj ,
    success: function (d) {
    if (d > 0) {
    alert("添加成功");
    }
    }
    })
    }
    </script>
    </head>
    <body>
    <div align="center">
    <table class="table table-bordered" style="40%;">
    <tr>
    <td>登录名:</td>
    <td><input id="txt_loginName" type="text" /></td>
    </tr>
    <tr>
    <td>密码:</td>
    <td><input id="txt_loginPwd" type="text" /></td>
    </tr>
    <tr>
    <td>用户姓名:</td>
    <td><input id="txt_Name" type="text" /></td>
    </tr>
    <tr>
    <td colspan="2"><input id="btn_Save" type="button" class="btn btn-primary" value="提交" onclick=" AddUser();" /></td>
    </tr>
    </table>
    </div>

    </body>
    </html>

  • 相关阅读:
    正则表达式
    git指令
    前端测试 Jest/(Mocha) Typescript/Javascript Vueunitstest
    mpvue使用wxcharts.js显示各类图表
    css margintop 失效
    reduce 黑科技
    vue cli 项目创建
    css实现垂直水平居中
    MySQL基础教程之存储过程
    4组Alpha冲刺2/6
  • 原文地址:https://www.cnblogs.com/XJNB/p/13150379.html
Copyright © 2020-2023  润新知