I use the following code to sort:
<button type="button" class="btn btn-default @(Model.SortOrder.Trim().ToUpper().Equals("NAME") ? "active" : "")">
@Ajax.ActionLink("Name", "Cause", "Search", new { query = Model.Query, category = Model.Category, pageNumber = 0, sortOrder = "NAME", sortDirection = "ASCENDING" }, new AjaxOptions() { UpdateTargetId = "SearchCauseSelfWidgetContent", InsertionMode = InsertionMode.Replace, OnSuccess = "PostAjaxLoad()" })
</button>
As expected, when I click on the text inside the button, it works, but if I click elsewhere (indents between the border of the buttons and the text), it does nothing.
Since there is no Url.helper for ajax methods, and no Ajax.ButtonLink, I lost a bit how to wrap the entire button in this ajax call.
source
share