I am working on an asp.net mvc-4 web application. and inside my view i have the following WebGrid inside my Razor view:-
@{
var gridcolumns = new List<WebGridColumn>();
gridcolumns.Add(new WebGridColumn()
{
ColumnName="OrderID",
Header = "",
Style="hidden-phone",
CanSort = false,
Format =
@<text>
@Html.ActionLink("Edit","Edit", "Order",new { id = item.OrderID },null)
</text>
});
//other columns goes here..
var grid = new WebGrid(
canPage: true,
rowsPerPage: Model.PageSize,
canSort: true,
ajaxUpdateContainerId: "grid");
grid.Bind(Model.Content, rowCount: Model.TotalRecords, autoSortAndPage: false);
grid.Pager(WebGridPagerModes.All);
@grid.GetHtml(htmlAttributes: new { id = "grid" }, // id for ajaxUpdateContainerId parameter
fillEmptyRows: false,
tableStyle: "table table-bordered table-hover",
mode: WebGridPagerModes.All,
columns: gridcolumns
);
}
now i want to hide specif WebGridColumns
on small devices. so i have defined the following inside the web grid as shown in the above code:-
Style="hidden-phone",
now this will hide the column content inside small devices (phones) , but still the column header will be shown. and i ended up having different number of headers compared to the body columns when i am viewing the WebGrid on small screens (phone).
so can anyone adivce how i can force the Style="hidden-phone"
, to apply to the column content and the column header. in other word to hide the specified column/s when i am viewing my WebGrid inside small sized screens ? as seems the WebGrid's Style property will NOT be applied to specified column header ?