Question

in this sample the sorting of the grid works well with the first column. Every other column can only be sorted ascending, the "sortdir" never switches to "DESC". (Ajax caching is also disabled)

Does anybody knows a solution or had the same problem? What im doing wrong?

Controller:

[OutputCache(Location = OutputCacheLocation.None)]
public ActionResult Index_Result_Org(string sort, string sortdir)
{
   this.setRep();
   this.rep.LoadOV();
   return View("Index_OV", rep.GetOV(sort != null ? sort : "Kennung", sortdir != null ? sortdir == "ASC" : true));
}

View:

@model List<Models.OV_View>
@{
    Layout = null;
    var grid_BA = Html.Grid<OV_View>(Model, ajaxUpdateContainerId: "BAS_OV", canPage: false, defaultSort: "Kennung");        
}
<div id="BAS_OV">
    @grid_BA.GetHtml(
    htmlAttributes: new { @id = "webgrid_BA" },
    alternatingRowStyle: "alt",
    tableStyle: "BAS",
    columns: grid_BA.Columns(
                         grid_BA.Column("Kennung", header: "Verbandskennung", format: @<text>@Html.Label(@item.Data.Kennung)</text>, canSort: true),
                         grid_BA.Column("Name", header: "Verbandsname", format: @<text>@item.Data.Name</text>, canSort: true),
                         grid_BA.Column("Anzahl", header: "Anzahl", format: @<text>@item.Data.Anzahl</text>, canSort: true, style: "counter_column"),
                         grid_BA.Column("Select", header: "X", canSort: false, format: @<text><input id="Select" name="Select" type="checkbox" onclick="Select(this)" value="@item.Select" @(item.Select == true ? "Checked" : null) /></text>, style: "checkbox_column"),
                         grid_BA.Column("ID", "", format: @<text>@item.Data.ID</text>, canSort: false, style: "invisible_column")
                            )
                      )
</div>

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top