First, paste the code of the front desk:
- @{
- Layout = null;
- }
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width" />
- <title>Test</title>
- <link href="/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
- <link href="/Content/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" />
- <!-- jQuery 2.1.4 -->
- <scrip{过滤}t src="/Content/bootstrap/plugins/jQuery/jQuery-2.1.4.min.js"></scrip{过滤}t>
- <scrip{过滤}t src="/Content/bootstrap/js/bootstrap.min.js"></scrip{过滤}t>
- <scrip{过滤}t src="/Content/bootstrap-table/bootstrap-table.js"></scrip{过滤}t>
- <scrip{过滤}t src="/Content/bootstrap-table/locale/bootstrap-table-zh-CN.js"></scrip{过滤}t>
- </head>
- <body>
- <div>
- <div id="toolbar">
- <div class="form-inline" role="form">
- <div class="form-group">
- <span>Offset: </span>
- <input name="offset" class="form-control w70" type="number" value="0">
- </div>
- <div class="form-group">
- <span>Limit: </span>
- <input name="limit" class="form-control w70" type="number" value="5">
- </div>
- <div class="form-group">
- <input name="search" class="form-control" type="text" placeholder="搜索">
- </div>
- <button id="ok" type="submit" class="btn btn-default">OK</button>
- </div>
- </div>
- <table id="table" data-toolbar="#toolbar"></table>
- </div>
- <scrip{过滤}t>
- $(function () {
- $('#table').bootstrapTable({
- url: '/SiteManager/Data',
- method: 'POST', //请求方式
- pagination: true, //分页
- striped:true,
- pageSize: 5, //每页显示的数量
- //cache:false, //禁用缓存
- pageList: [10, 25, 50, 100], //数据分页数
- //search:true, //搜索
- //queryParams: queryParams, //参数
- sidePagination: 'server',//设置为服务器端分页
- columns: [{
- field: 'SiteName',
- title: '站点名称'
- }, {
- field: 'SiteUrl',
- title: '域名'
- }, {
- field: '',
- title: '认证方式'
- }, {
- field: '',
- title: '状态'
- }, {
- field: 'CreateDate',
- title: '创建时间'
- }]
- });
- });
- function queryParams(params) {
- return {
- pageSize: params.limit,
- pageNumber: params.pageNumber,
- };
- }
- </scrip{过滤}t>
- </body>
- </html>
Copy code
Today, when using bootstrap-table for server pagination, I always can't get the page number from the front to the background and a series of parameters.
Generally, the background values are taken through the three methods of Request.Form, Request.Params, and Request.QueryString.
However, when I set the power off in the background for debugging, I couldn't get the corresponding information, and then the browser ran F12 to see the sent data packet, as follows:
The parameters are passed through Request payload, and then I went to msdn to look at the documentation, only to find out that if the value is taken, no one on the Internet has encountered this problem???? I'm surprised!
C# asp.net Background Retrieval Method:
- var bytes = new byte[Request.InputStream.Length];
- Request.InputStream.Position = 0;
- Request.InputStream.Read(bytes, 0, bytes.Length);
- string str = Encoding.UTF8.GetString(bytes);
Copy code http://www.itsvse.com/thread-2382-1-1.html
|