This project is read-only.

Grid: Method or Class

Jul 28, 2010 at 11:44 PM

Until now I have implemented the grid as an extention method of HtmlHelper. It works with a column builder, like the sample bellow:

Html.Grid(m => m.Id).Columns(column => {
            column.ForData(m => m.Id);
            column.ForData(m => m.Name);
            column.ForData(m => m.Email);
            column.ForData(m => m.Deleted);

But I'm thinking to change it to a class (named ModelViewGrid) that uses the "using" statement like the ModelViewForm class. It would look like that:

using(var grid = Html.Grid(m => m.Id/* grid global options */)) {
            grid.AddDataColumn(m => m.Id);
            grid.AddDataColumn(m => m.Name);
            grid.AddDataColumn(m => m.Email);
            grid.AddDataColumn(m => m.Deleted);

Both aproaches have advantages and drawbacks.

I want to know your opinion...