代码:
@{
ViewBag.Title = "Index";
}
@section Scripts {
@Scripts.Render("~/bundles/index")
}
<link href="~/Jqgrid/css/cupertino/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" />
<link href="~/Jqgrid/css/cupertino/ui.jqgrid.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.8.2.js"></script>
<script src="~/Jqgrid/js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="~/Jqgrid/js/i18n/grid.locale-cn.js"></script>
<script src="~/Jqgrid/js/jquery.jqGrid.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#table_content").jqGrid({
url: "~/Files/list.txt",
datatype: "json",
mtype: "get",
height: 420,
autowidth: true,
colNames: ['编号', '城市', '国家', '手机号码'],
colModel: [
{ name: 'CustomerID', index: 'CustomerID', width: '20%', align: 'center' },
{ name: 'City', index: 'City', width: '20%', align: 'center', sortable: false },
{ name: 'Country', index: 'Country', width: '20%', align: 'center', sortable: false },
{ name: 'Phone', index: 'Phone', width: '20%', align: 'center', sortable: false }
],
rownumbers: true,
viewrecords: true,
rowNum: 15,
rowList: [15, 20, 25],
jsonReader: {
root:"people",
repeatitems: false
},
pager: '#gridPager'
});
});
</script>
<style type="text/css">
#table_content tr{
border:1px solid black;
}
#first_id{
background-color:pink;
}
</style>
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<p>
片名:<input id="input_searching" type="text" /><br />
<input type="submit" value="查询" onclick="search()" />
@Html.ActionLink("查看所有", "Index")
</p>
<p>@ViewBag.Message</p>
<table id="table_content">
</table>
<div id="gridPager"></div>
调换一下js的引入顺序就好了