对于排序的东西,你可以看看这篇文章:
System.Web.Helpers.WebGrid 中的排序指示器
在视图中,您可以这样做:
// Force a descending sort only when no user specified sort is present
if (Request.QueryString[grid.SortDirectionFieldName].IsEmpty())
{
grid.SortDirection = SortDirection.Descending;
}
然后是自定义 JavaScript:
displaySortIndicators('@grid.SortColumn', '@grid.SortDirection');
displaySortIndicators = function (column, sortDirection) {
if (column != '') {
var th = $('thead > tr > th > a[href*="sort=' + column + '"]');
th.append((sortDirection == 'Ascending') ? "▲" : "▼");
}
}
对于工具提示,您可以使用qTip2。
注意:我将上面链接中的两种方法与 WebGrid 帮助程序一起使用,它们按预期工作。