Monday, 15 June 2015

asp.net mvc 3 - Telerik MVC Grid paging Querystring Parameters -



asp.net mvc 3 - Telerik MVC Grid paging Querystring Parameters -

i'm using telerik mvc controls heavily, grid , tab strip. on "customer edit" screen, have tab strip such following:

@(html.telerik().tabstrip() .name("customer-info") .items(tabs => { tabs.add().text("addresses").content(addresses().tohtmlstring()); tabs.add().text("phone / email").content(phonenumbers().tohtmlstring()); tabs.add().text("card numbers").content(cardnumbers().tohtmlstring()); tabs.add().text("adjustments").content(adjustments().tohtmlstring()).visible(model.usercanaddadjustments); tabs.add().text("transactions").content(transactions().tohtmlstring()); tabs.add().text("account info").content(accountinfo().tohtmlstring()); }) .selectedindex(currenttab))

in "transactions" tab, have grid right using ajax binding:

@(html.telerik().grid<transaction>() .name("transactions") .databinding(bind => bind.ajax().select("accounttransactionbinding", "accounts", new { customerid = model.customerid })) .columns(cols => { cols.bound(x => x.transactiondate).format("{0:d}").title("date").width("10%"); cols.bound(x => x.outlet.name).title("outlet").width("15%"); cols.bound(x => x.checknumber).title("check/folio").width("15%"); cols.bound(x => x.type.name).title("type").width("15%"); cols.bound(x => x.cardnumber).width("15%"); cols.bound(x => x.amountspent).format("{0:c2}").width("15%"); cols.bound(x => x.basepoints).title("points").width("15%"); }) .pageable(paging => paging.pagesize(15)) .sortable(sort => sort.orderby(ob => ob.add(x => x.transactiondate).descending())) .filterable())

unfortunately, need add together additional items grid not allow me in ajax binding. can alter server binding, issue paging. grid have hundreds or thousands of items, needs paging. if utilize paging "regular" way, works, defaults first tab on every page load.

now background out of way, question: there way "append" querystring parameter paging url?

if still have problems this, can gridcommand parameter in backend binding, here's code can help :

[gridaction(enablecustombinding = true)] public virtual actionresult listcompanyajax(genericsearchmodel searchmodel, gridcommand command) { var info = _searchservice.searchcompany(searchmodel); if (searchmodel != null && !string.isnullorwhitespace(searchmodel.text)) { info = data.tolist().orderbydescending(x => x.getpower(searchmodel.text)).asqueryable(); } else if(command.sortdescriptors.count == 0) command.sortdescriptors.add(new sortdescriptor{member = "name", sortdirection = listsortdirection.ascending}); var results = info .select(x => new companyforlistingmodel { id = x.id, name = x.name, isactive = x.isactive, isnotactive = !x.isactive, class = x.type.name }) .togridmodel(command.page, command.pagesize, command.sortdescriptors, command.filterdescriptors, command.groupdescriptors); homecoming view(results); }

asp.net-mvc-3 razor telerik telerik-grid

No comments:

Post a Comment