279

If you are using ASP.NET MVC how are you doing grid display? Rolled your own? Got a library from somewhere?

These are some of the known grid display solutions I have found for ASP.NET MVC

If you know of anything else that you are using or know to be good, please let me know.

juFo
  • 17,849
  • 10
  • 105
  • 142
MikeJ
  • 14,430
  • 21
  • 71
  • 87
  • 5
    I was hoping of a grid with javascript support but which could nicely degrade to a full GET request if the JavaScript is disabled. However I will have to build my own :( – Andrei Rînea Feb 03 '09 at 23:33
  • 1
    I would go with Datatables or jQuery grid – Maksym Kozlenko Jul 31 '12 at 00:23
  • 18
    couldn't agree with you more.. i've had well voted questions closed as well, but i was surprised this one was too. getting good up votes should speak for how constructive a question is. that's not enough to these moderators as they're over-eager show us what's constructive and what is not. – Sonic Soul Dec 31 '12 at 18:26
  • 11
    Yeah, this question is very constructive to me. But they always close questions that ask which library is the best to use. – Josh Mouch Feb 21 '13 at 23:35
  • 11
    It remains pretty astonishing to me that these "moderators" seem to think they know what's useful better than the people who, umm, find them useful. – Ken Smith Jun 15 '13 at 22:52
  • 4
    I couldn't agree more. con·struc·tive adjective 1. serving a useful purpose; tending to build up. – Dave Jellison Sep 24 '13 at 12:10
  • ASP.NET / IQuerable support for datatables.net here: http://github.com/mcintyre321/mvc.jquery.datatables – mcintyre321 May 04 '16 at 08:35
  • 1
    hate these "not constructive" type closes. total bs. – Joe Healy Feb 22 '17 at 20:50
  • https://jsgrids.io/ is a list of data grid libraries. You can filter the results to only show jQuery-specific libraries. – a paid nerd Jul 14 '20 at 00:38

12 Answers12

40

We have been using jqGrid on a project and have had some good luck with it. Lots of options for inline editing, etc. If that stuff isn't necessary, then we've just used a plain foreach loop like @Hrvoje.

Sean Carpenter
  • 7,681
  • 3
  • 37
  • 38
29

We use Slick Grid in Stack Exchange Data Explorer (example containing 2000 rows).

I found it outperforms jqGrid and flexigrid. It has a very complete feature set and I could not recommend it enough.

Samples of its usage are here.

You can see source samples on how it is integrated to an ASP.NET MVC app here: https://code.google.com/p/stack-exchange-data-explorer/

Cœur
  • 37,241
  • 25
  • 195
  • 267
Sam Saffron
  • 128,308
  • 78
  • 326
  • 506
  • It's very nice and performant, but only if you are going to *always* use simple data and columns (I find myself adding some touch as rowspans, graphics, etc to some tables to make them nicer) – Eduardo Molteni Sep 17 '11 at 17:22
  • Looking to the samples... it seems that you can do lots of things with this grid... I liked... – Romias Sep 24 '11 at 16:44
  • are you still using slickgrid? – naveen Dec 24 '15 at 15:55
24

We have just rolled our own due to limited functionality requirements on our grids. We use some JQuery here and there for some niceties like pagination and that is all we really need.

If you need something a little more fully featured you could check out ExtJs grids here.

Also MvcContrib has a grid implementation that you could check out - try here. Or more specifically here.

berko
  • 2,935
  • 4
  • 26
  • 31
16

I just discovered Telerik has some great components, including Grid, and they are open source too. http://demos.telerik.com/aspnet-mvc/

Dejan Milicic
  • 819
  • 9
  • 18
  • 9
    I spent the last day working with the Telerik grid, and it's pretty nice, if you can manage to stay on the ever-elusive "happy path." However, my app uses restful routing (i.e., where my deletes would post to "/controller/{id}" with an Http Method override of DELETE), and that was apparently too far off the "happy path" for the Telerik grid to be useful to me, and their code is too tightly coupled to cleanly override its behavior through inheritance, etc. – James Nail Oct 14 '10 at 20:04
  • 10
    It should be noted that the terms of their Open Source product means it should only be used on GPLv2 Compatible Open Source projects. That rules out a lot of commercial applications - if you want to stay legal :) – James McCormack May 11 '12 at 08:55
  • 5
    I was never happy with Telerik components. They look good and work with standard functionality, but things get worse when you try doing something which is not part of demo. You may check their Kendo UI. It's heaps better, but still not perfect – Maksym Kozlenko Jul 31 '12 at 00:21
12

If it's just for viewing data, I use simple foreach or even aspRepeater. For editing I build specialized views and actions. Didn't like webforms GridView inline edit capabilities anyway, this is kinda much clearer and better - one view for viewing and another for edit/new.

Hrvoje Hudo
  • 8,994
  • 5
  • 33
  • 42
  • I agree. I don't like inline editing in a grid either. – René Mar 24 '11 at 13:23
  • 1
    And from UX point of view, it's better to have more small screens then one big and complex. Also that fits better to good server side code design (OOP), because you can have separated behaviors for screen commands, and not one big db.Save(pageData), moving toward verbs on domain model, unlike "just" bunch of model CRUD methods. – Hrvoje Hudo Jul 21 '11 at 14:20
  • I too agree as I do not like inline editing. Separation of concern eases the task. – Hemal Dec 08 '15 at 06:18
7

We use the MVCContrib Grid.

http://weblogs.asp.net/rajbk/archive/2010/05/08/asp-net-mvc-paging-sorting-filtering-using-the-mvccontrib-grid-and-pager.aspx

Raj Kaimal
  • 8,304
  • 27
  • 18
  • I had seen you tutorial code in one of the rss feeds. It was helpful to me on a project I just started. – MikeJ May 31 '10 at 15:56
7

jqGrid is $299 if you use a special version that has server side integration, but it really is not that difficult to use the open source free version with ASP.NET MVC, once you get your jquery configuration straight it's almost as simple to use as any other licensed grid:

http://haacked.com/archive/2009/04/14/using-jquery-grid-with-asp.net-mvc.aspx

Manuel Castro
  • 2,460
  • 1
  • 19
  • 14
7

You can use also the Insert/update/delete datagrid of my MVC Controls Toolkit available here on codeplex: http://mvccontrolstoolkit.codeplex.com/. Here you can download a complete example, here the datagrid working and here and here tutorials. The DataGrid works completely client side and mantains thechange set between posts. Yes it mantains Changeset, this means, you can access both old version and modified version of each record to see what changes to pass to the DB(what need to be modified deleted or inserted). This Changeset is mantained after several posts till you either confirm or cancel the modifications on the server side.

Francesco Abbruzzese
  • 4,139
  • 1
  • 17
  • 18
5

If it is read-only a good idea would be to create a table, then apply some really easy-but-powerful JQuery to that.

For simple alternative colour, try this simple JQuery.

If you need sorting, this JQuery plug-in simply rocks.

Mark Kadlec
  • 8,036
  • 17
  • 60
  • 96
  • 1
    yes. I saw this. Scott Hanselman was talking about this when Phil Hack posted his repeater helper code in this article : http://haacked.com/archive/2008/05/03/code-based-repeater-for-asp.net-mvc.aspx – MikeJ Jun 25 '10 at 19:51
  • 1
    I think that's how I found out about the first link as well! Most of the grid stuff I do now is mostly done on the client. Scott's tip was well taken. – Mark Kadlec Jun 25 '10 at 22:38
4

I tried the example here of the Mvc Controls Toolkit grid. It appears a quite powerful and easy to use grid. The tutorial not only explain how to use the grid but also how to do paging, organize a view model and data annotations. It is worth to read it.

MvcSurfer
  • 71
  • 2
3

Try: http://mvcjqgridcontrol.codeplex.com/ It's basically a MVC-compliant jQuery Grid wrapper with full .Net support

sternr
  • 31
  • 1
2

Check out the grid from Infragistics jQuery controls

Here is a ASP.NET MVC sample with code:

http://labs.infragistics.com/aspnet-mvc/Grid/AllFeatures

akshayl
  • 617
  • 1
  • 6
  • 15
  • Thanks. Will add to list above. – MikeJ Jun 15 '11 at 20:12
  • Mike, you can add the following to the list: http://www.infragistics.com/dotnet/netadvantage/jquery-controls/grid.aspx – akshayl Oct 04 '11 at 07:12
  • I have updated with a link to the igGrid from infragistics. sorry for the delay as I have been away for thanksgiving. igGrid looks interesting. – MikeJ Oct 10 '11 at 19:26
  • 1
    Coming from someone who's tried to use this in a production app, I would not recommend this grid. It's buggy, poorly documented, and there's virtually no community support, possibly because it's not open source. Most of the features (sorting, column resizing, etc.) have issues with them that involve various work-arounds and compromises. The Winforms Infragistics grid we'd used in the past worked great, but I'd steer clear of their web version until it's more baked. – Josh Noe Nov 28 '12 at 16:01