asp.net mvc - Searching & sorting with AJAX pagination in MVC4 -


i developing mvc4 application searching, paging , sorting. works fine normal view. converting same application using ajax & partial view. how can pass search & sort parameter through paging control residing on partial view. now, able load filtered data in partial view moving next page, lost search parameters , loads records ignoring search filters.

my paging control in _partialview.cshtml

@html.pagedlistpager(model,                         page => url.action("ajaxmethod",                              new                              {                                   page,                                 searchbyusername = request.querystring["searchbyusername"],                                 searchbyreadername = request.querystring["searchbyreadername"],                                 searchbyreadertype = request.querystring["searchbyreadertype"],                                 searchbyuploaddate = request.querystring["searchbyuploaddate"],                                 sortby = request.querystring["sortby"]                             }),                          //new pagedlistrenderoptions.() { display = pagedlistdisplaymode.ifneeded, displaypagecountandcurrentlocation = true }                         pagedlistrenderoptions.enableunobtrusiveajaxreplacing( new ajaxoptions(){ httpmethod = "get", updatetargetid = "divdata"})                         ) 

please suggest, missing....

i came know m missing, partial view doesn't got request.querystring values thats why paging control lost search parameters , loads records. modified pager control in _partialview.cshtml follows :

@html.pagedlistpager(model,                         page => url.action("ajaxmethod",                             new                             {                                 page,                                 searchbyusername = viewbag.searchbyusername, // request.querystring["searchbyusername"],                                 searchbyreadername = viewbag.searchbyreadername, // request.querystring["searchbyreadername"],                                 searchbyreadertype = viewbag.searchbyreadertype, // request.querystring["searchbyreadertype"],                                 searchbyuploaddate = viewbag.searchbyuploaddate, // request.querystring["searchbyuploaddate"],                                 sortby = viewbag.sortby // request.querystring["sortby"]                             }),                                                 pagedlistrenderoptions.enableunobtrusiveajaxreplacing(new ajaxoptions()                          { httpmethod = "get", updatetargetid = "divdata", loadingelementid="divloading" })                         )

these viewbag objects initialized in controllers action method. having better solution above problem. please suggest.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -