Note that there are some explanatory texts on larger screens.

plurals
  1. POPaging and Sorting in Mutliple Partial View with MVC Contrib
    primarykey
    data
    text
    <p>I create an application using asp mvc razor + mvc grid. My problem is : i have one view that contain multiple action that return partial view, in each partial view there is a grid that display the data. I am using mvc contrib grid which support paging and sorting.</p> <p>My view (index.cshtml) : </p> <pre><code>&lt;div class="row-fluid"&gt; &lt;div id="formations" class="control-group"&gt; @Html.Action("Formations") &lt;/div&gt; &lt;div id="pools" class="control-group"&gt; @Html.Action("Pools") &lt;/div&gt; &lt;div id="zones" class="control-group"&gt; @Html.Action("Zones") &lt;/div&gt; </code></pre> <p></p> <p>Formations action : </p> <pre><code> public ActionResult Formations(GridSortOptions sort, int? page, string filter = "all") { IPagination&lt;StratUnitVo&gt; pagination = .... return PartialView("_Formations", pagination); } </code></pre> <p>Partial View _Formations :</p> <pre><code>@Html.Grid(Model).Sort(ViewData["sort"] as GridSortOptions).Columns(col =&gt; { col.For(p =&gt; Html.ActionLink(p.LongName, "EditFormation", "Stratigraphy", new { id = p.Id }, null).ToHtmlString()).Encode(false).Named(Locale.Name).SortColumnName("LongName"); col.For(p =&gt; p.FormCode).Named(Locale.Code); col.For(p =&gt; p.ReferenceStratUnit.LongName).Named(Locale.ReferenceFormation); }).Attributes(@class =&gt; "table table-condensed table-striped table-hover") @if (Model.Count() &gt; 0) { @Html.Raw(@Html.Pager(Model))); } </code></pre> <p>Other action and view is most like sample above (just difference in the model data). My problem is :</p> <ol> <li>When i click the navigation paging in one grid (example : Formations), the other grid (Pools and Zones) will be navigate to. For example : click page 2 in formations grid will move another grid to page 2 too.</li> <li>When i click the column header in one grid (which mean i want to sort the data), the whole page is replaced by partial view. What i want is only the grid that i have clicked is sorted.</li> </ol> <p>How can i fix that ?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload