asp.net mvc - C# MVC with jQuery Datatables: Retrieving variables from GET -
this query string datatables.net sends mvc action:
?secho=8&icolumns=6&scolumns=&idisplaystart=0&idisplaylength=10&mdataprop_0=homecountry&mdataprop_1=hostcountry&mdataprop_2=yearonerate&mdataprop_3=yearotherrate&mdataprop_4=ratetype&mdataprop_5=controls&ssearch=&bregex=false&ssearch_0=&bregex_0=false&bsearchable_0=true&ssearch_1=&bregex_1=false&bsearchable_1=true&ssearch_2=&bregex_2=false&bsearchable_2=true&ssearch_3=&bregex_3=false&bsearchable_3=true&ssearch_4=&bregex_4=false&bsearchable_4=true&ssearch_5=&bregex_5=false&bsearchable_5=true&isortcol_0=1&ssortdir_0=asc&isortingcols=1&bsortable_0=true&bsortable_1=true&bsortable_2=true&bsortable_3=true&bsortable_4=true&bsortable_5=false&_=1391446190711
this controller action header in mvc:
public jsonresult getdata(int secho, int idisplaystart, int idisplaylength, string ssearch) my question is: how variables such these (?):
bsortable_0=true&bsortable_1=true&bsortable_2=true&bsortable_3=true&bsortable_4=true&bsortable_5=false
notice how number after bsortable_ 0 5 or more.
to parse querystring -
namevaluecollection querycollection = httputility.parsequerystring(request.url.query); var items = querycollection .allkeys .selectmany(querycollection.getvalues, (k, v) => new { key = k, value = v }) .where(p => p.key.contains("bsortable")) .tolist(); and output -

Comments
Post a Comment