I'd like to sort the data in WebGrid by clicking the header of the column with some other parameters post to the controller, but the WebGrid's autosorting supply a fixed link on the column header with only two parameters.
I found some way to change the link address on the WebGrid's column header, but it works only on common links and not a ajax ActionLink
, so that I can't use partial view to reflash only part of the webpage.
Can anyone help me to solve the question ?
var grid = new WebGrid(Model, canPage: true, rowsPerPage: 2);
@grid.GetHtml(tableStyle: "Contact``TB",headerStyle: "ContactHD",columns: grid.Columns(
grid.Column("ID",
@Ajax.ActionLink("ID","Index","Home",new { pid = Model.PageIndex, sort=true},
new AjaxOptions { UpdateTargetId = "grid",
HttpMethod = "POST",
InsertionMode = InsertionMode.Replace
}
),
model.id,
))
);
The code up is the example effect I want to have, it's a wrong code.