0
編輯:問題是url參數被髮送像:列[0] [名稱]和Asp.Net不拾取[名稱]屬性。我如何讓Asp.Net捕獲名稱屬性?ASP.Net模型綁定問題 - DataTables.net
我正在使用jQuery DataTables 1.10(新版本)和處理服務器端。我越來越格式如下HTTP請求:
請求報頭:
Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,it;q=0.6
Cache-Control:no-cache
Connection:keep-alive
Pragma:no-cache
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36
X-Requested-With:XMLHttpRequest
變量在請求的查詢字符串編碼:
draw:16
columns[0][data]:0
columns[0][name]:
columns[0][searchable]:true
columns[0][orderable]:true
columns[0][search][value]:
columns[0][search][regex]:false
columns[1][data]:1
columns[1][name]:
columns[1][searchable]:true
columns[1][orderable]:true
columns[1][search][value]:
columns[1][search][regex]:false
columns[2][data]:2
columns[2][name]:
columns[2][searchable]:true
columns[2][orderable]:true
columns[2][search][value]:
columns[2][search][regex]:false
order[0][column]:0
order[0][dir]:desc
start:0
length:10
search[value]:Log
search[regex]:false
模型綁定成功地解析出第一級。我可以看到有3列,1個訂單和一個搜索,但這些都是空的。我應該如何製作模型以便能夠正確綁定?我試過了一本字典和一個數組無濟於事。
僅供參考這裏是我的模型,我想要綁定:
public class DataTableParameterModel
{
public int draw { get; set; }
public int start { get; set; }
public int length { get; set; }
public DataTablesSearch search { get; set; }
public DataTablesColumn[] columns { get; set; }
public DataTablesOrder[] order { get; set; }
public int folderId { get; set; }
}
public class DataTablesColumn
{
public string data { get; set; }
public string name { get; set; }
public bool searchable { get; set; }
public bool orderable { get; set; }
public DataTablesSearch search { get; set; }
}