asp.net mvc 3 - Make the MVCContrib-generated-column-names to make ajax calls -
it sounds simple question, i've been strugling entire afternoon. i'm trying put grid in partialview pagination, sorting , everything. first problem pager links: did not hold filter options, since not on pages query string. that's how solved it:
public class paginationcontainer { public ipagination paginatedresult { get; set; } public routevaluedictionary routevaluedictionary { get; set; } } i created class, used pager:
@using mvccontrib.ui.pager @model aqxweb.models.paginationcontainer @{ string action = viewcontext.controller.valueprovider.getvalue("action").rawvalue.tostring(); string controller = viewcontext.controller.valueprovider.getvalue("controller").rawvalue.tostring(); } @functions { public routevaluedictionary getroute(int page) { var routevalues = new routevaluedictionary(); foreach (string key in model.routevaluedictionary.keys) { routevalues[key] = model.routevaluedictionary[key]; } routevalues["page"] = page; return routevalues; } } <p /> <div class='pagination'> <span class='paginationleft'>mostrando @model.paginatedresult.firstitem - @model.paginatedresult.lastitem de @model.paginatedresult.totalitems</span> <span class='paginationright'> @{ if (model.paginatedresult.haspreviouspage) {<text> @html.actionlink("primeira", action, controller, getroute(1), new dictionary<string, object> { { "class", "paging" } }) | </text>} else {<text> primeira | </text>} if (model.paginatedresult.haspreviouspage) {<text>@html.actionlink("anterior", action, controller, getroute(model.paginatedresult.pagenumber - 1), new dictionary<string, object> { { "class", "paging" } }) | </text>} else {<text>anterior | </text>} if (model.paginatedresult.hasnextpage) {<text>@html.actionlink("próxima", action, controller, getroute(model.paginatedresult.pagenumber + 1), new dictionary<string, object> { { "class", "paging" } }) | </text>} else {<text>próxima | </text>} if (model.paginatedresult.hasnextpage) {<text>@html.actionlink("Ãltima", action, controller, getroute(model.paginatedresult.totalpages), new dictionary<string, object> { { "class", "paging" } })</text>} else {<text>Ãltima</text>} } </span> </div> all have fill dictionary, on actionmethod.
now need similar solution sorting ... need override table headers created mvccontrib add filter options , add class attribute called "paging", use make ajax calls. exposed method .header(string) igridcolumn<>, and, honestly, sucks (i'll have stuff hand in order achieve goal). trying create extension method cope this, proved quite difficult, since .header(string) not exposed:
(please overlook bad naming)
public static igridcolumn<t> ajaxify(this igridcolumn<t> column, string columnname, string classname, routevaluedictionary routevaluedictionary) { string newdecoration = "<td> <a href="+getroute(routevaluedictionary)+"class=\""+classname+"\">"+ columnname + "</a></td>"; return column.header(newdecoration); } i think intention here quite clean, method wouldn't work, because somehow can't access .header(string) method. ideas?
| it sounds simple question, i've been strugling entire afternoon. i'm trying put grid in partialview pagination, sorting , everything. first problem pager links: did not hold filter options, since not on pages query string. that's how solved it: i created class, used pager: all have fill dictionary, on actionmethod. now need similar solution sorting ... need override table headers created mvccontrib add filter options , add class attribute called "paging", use make ajax calls. exposed method (please overlook bad naming) i think intention here quite clean, method wouldn't work, because somehow can't access | ||||
| |