Andrus Andrus - 4 months ago 110
jQuery Question

How to render webgrid at third column and without headers

ASP.NET MVC4 Razor application page contains table.
Table first two columns have fixed names. Other columns have variable names created dynamically from pivot table.

Code below renders all columns and created table header with property names.

How to rendel table starting at third column so first two columns are not shown ?
How to render table without column headers ?


@inherits ViewBase<ViewModels.CustomerCardViewModel>

var gd = new WebGrid(source: Model.Rows.Skip(1), canPage: false, canSort: false, rowsPerPage: 1000);

... head skipped
<hr />


public class CustomerCardViewModel : ViewModelBase
public IEnumerable<dynamic> Rows { get; set; }

ASP.NET MVC4, Razor, Bootstrap 3, jquery are used.


1.To render a table without column headers:


2.To hide columns - If you have a static list of columns you can use How to hide a column in the Webgrid in MVC? but if it's dynamic then just write a little function using jQuery to hide the desired columns:

$('.table tr').each(function () {
    var tr = $(this);
    var children = tr.children();