首页 > Web开发 > 详细

ASP.Net 显示

时间:2020-06-17 10:59:38      阅读:53      评论:0      收藏:0      [点我收藏+]

@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="width: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>

ASP.Net 显示

原文:https://www.cnblogs.com/XJNB/p/13150379.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!