To WebGrid or not to WebGrid...what is the answer?
Asked Answered
B

6

28

I'm reading and hearing some pain points and am wondering if I should even go that route. Not to mention, I cannot seem to find any definitive documentation (from Microsoft). If you say I shouldn't use it, what route would you suggest? I'm trying to get a new site off the ground, but I want to do it right the first time.

Boat answered 9/2, 2011 at 5:26 Comment(1)
This may be more recent then the post, but this is the official documentationErwin
E
15

I would say you should choose to use WebGrid if you are looking to quickly and easily display data and not have to rely on any external libraries. However, if you're looking for a fully-featured grid, I would not go with WebGrid right now. There are difficulties in applying styles and doing more advanced aspects that are available in other popular web grid libraries.

As for my opinion on what you should use - if WebGrid does not meet your needs, check out jqGrid. It's a very popular package and works amazingly well and is fairly easy to setup and run.

If you would like more documentation on WebGrid, check out Microsoft's ASP.NET MVC 3 tutorial site.

Elson answered 4/3, 2011 at 20:15 Comment(1)
WebGrid documentation link is outdated (redirects to another page)Garnishment
A
9

I looked at pure html tables, mvccontrob grid, jqgrid, and webgrid. With only limited experience with all three here is what I found:

jQgrid is the most powerful and supports jquery UI themeing. I was able to implement inline editing, sorting, filtering, and simple server-side validation. It took me three days to figure it out, but that is not too bad considering all the features I implemented. I was able to figure it out by searching the internet and finding examples, so there is a lot of resources out there for it. It does involve a lot of javascript, though. The thing I liked the least about it was the search feature. It has too many options turned on by default and I am having trouble turning off the ones I don't want to use.

Mvccontrib grid was very easy to get up and running but inline edting is not supported. Also, I read this post which to me sounds like it won't be supported much longer: mvccrontrib

Bummer, it was a very nice and easy to use grid.

I found webgrid to be easy to set up but it also has no inline editing. Its default paging I guess is really inefficient too, it always returns all rows regardless of the # records per page.

If you need inline editing, jqgrid is definitely the way to go.

If not, I would have said Mvccontrib if it wasn't being shelved. That leaves me with pure html tables or webgrid, and I like the pure html tables better, as Naveen recommended. I was able to implement sorting, paging, and filtering pretty easily.

I am going to stick with jqgrid now that i have a working example and look at Jquery UI Grid when it is in production.

Adahadaha answered 29/12, 2012 at 17:12 Comment(0)
X
8

I cannot tell you whether you should use or not the WebGrid helper because that would be subjective and especially as you just talked about pain points in your question without any specific details. What I could do is offer you some good alternatives:

Xmas answered 9/2, 2011 at 21:25 Comment(2)
So my major pain point is a lack of documentation. If you know of some, please point me in the right direction.Boat
I second the vote for the MvcContrib Grid. I tried both WebGrid and MvcContrib Grid for an app I'm creating. I found that the MvcContrib Grid was far easier to use, and didn't require any disgusting dynamic types.Benevento
S
3

I haven't found any official documentation -- only tutorials and samples. But I did find this page which lists all the methods available on the Web Grid Razor Helpers API Reference

Also lists the API for other Razor helper methods.

Stanwood answered 6/5, 2011 at 18:11 Comment(0)
C
3

Taken Verbatim from the reference link below:

To show a simple example of WebGrid, I’ve set up an ASP.NET MVC action that simply passes an IEnumerable to the view. I’m using the Razor view engine for most of this article, but later I’ll also discuss how the WebForms view engine can be used. My ProductController class has the following action:

public ActionResult List()
{
  IEnumerable<Product> model =  _productService.GetProducts();
  return View(model); 
}

The List view includes the following Razor code, which renders the grid shown in Figure 1:

@model IEnumerable<MsdnMvcWebGrid.Domain.Product> 
@{ ViewBag.Title = "Basic Web Grid"; }

<h2>Basic Web Grid</h2>
<div>
   @{ var grid = new WebGrid(Model, defaultSort:"Name"); }
   @grid.GetHtml()
</div>

Reference: This page shows some more examples of WebGrid http://msdn.microsoft.com/en-us/magazine/hh288075.aspx

Calton answered 30/4, 2014 at 17:58 Comment(1)
Link only answers (especially to a multi-year old question) are not helpful as links tend to break. Pull relevant portions of your link into this answer to ensure the data is still available, even if the link is not.Ambroid
C
2

WebGrid seems like a productivity tool, a good article on its use in July issue of MSDN here

Concise answered 4/7, 2011 at 20:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.