This article is a mirror article of machine translation, please click here to jump to the original article.

View: 17298|Reply: 0

[Bootstrap] bootstrap-table server paging background value problem

[Copy link]
Posted on 11/6/2015 5:28:00 PM | | | |
First, paste the code of the front desk:

  1. @{
  2.     Layout = null;
  3. }

  4. <!DOCTYPE html>

  5. <html>
  6. <head>
  7.     <meta name="viewport" content="width=device-width" />
  8.     <title>Test</title>
  9.     <link href="/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
  10.     <link href="/Content/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" />
  11.     <!-- jQuery 2.1.4 -->
  12.     <scrip{过滤}t src="/Content/bootstrap/plugins/jQuery/jQuery-2.1.4.min.js"></scrip{过滤}t>
  13.     <scrip{过滤}t src="/Content/bootstrap/js/bootstrap.min.js"></scrip{过滤}t>
  14.     <scrip{过滤}t src="/Content/bootstrap-table/bootstrap-table.js"></scrip{过滤}t>
  15.     <scrip{过滤}t src="/Content/bootstrap-table/locale/bootstrap-table-zh-CN.js"></scrip{过滤}t>
  16. </head>
  17. <body>
  18.     <div>
  19.         <div id="toolbar">
  20.             <div class="form-inline" role="form">
  21.                 <div class="form-group">
  22.                     <span>Offset: </span>
  23.                     <input name="offset" class="form-control w70" type="number" value="0">
  24.                 </div>
  25.                 <div class="form-group">
  26.                     <span>Limit: </span>
  27.                     <input name="limit" class="form-control w70" type="number" value="5">
  28.                 </div>
  29.                 <div class="form-group">
  30.                     <input name="search" class="form-control" type="text" placeholder="搜索">
  31.                 </div>
  32.                 <button id="ok" type="submit" class="btn btn-default">OK</button>
  33.             </div>
  34.         </div>
  35.         <table id="table" data-toolbar="#toolbar"></table>
  36.     </div>
  37.     <scrip{过滤}t>
  38.         $(function () {
  39.             $('#table').bootstrapTable({
  40.                 url: '/SiteManager/Data',
  41.                 method: 'POST',          //请求方式
  42.                 pagination: true,         //分页
  43.                 striped:true,
  44.                 pageSize: 5,             //每页显示的数量
  45.                 //cache:false,            //禁用缓存
  46.                 pageList: [10, 25, 50, 100],    //数据分页数
  47.                 //search:true,                //搜索
  48.                 //queryParams: queryParams,   //参数
  49.                 sidePagination: 'server',//设置为服务器端分页
  50.                 columns: [{
  51.                     field: 'SiteName',
  52.                     title: '站点名称'
  53.                 }, {
  54.                     field: 'SiteUrl',
  55.                     title: '域名'
  56.                 }, {
  57.                     field: '',
  58.                     title: '认证方式'
  59.                 }, {
  60.                     field: '',
  61.                     title: '状态'
  62.                 }, {
  63.                     field: 'CreateDate',
  64.                     title: '创建时间'
  65.                 }]
  66.             });
  67.         });
  68.         function queryParams(params) {

  69.             return {
  70.                 pageSize: params.limit,

  71.                 pageNumber: params.pageNumber,

  72.             };
  73.         }
  74.     </scrip{过滤}t>
  75. </body>
  76. </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:


  1. var bytes = new byte[Request.InputStream.Length];
  2.             Request.InputStream.Position = 0;
  3.             Request.InputStream.Read(bytes, 0, bytes.Length);

  4.             string str = Encoding.UTF8.GetString(bytes);
Copy code
http://www.itsvse.com/thread-2382-1-1.html




Previous:.NET C# questions about Request payload taking values in the background
Next:.net Read &amp; Split Parameters How to find the parameters you want
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com