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.
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.
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.
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:
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.
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
WebGrid seems like a productivity tool, a good article on its use in July issue of MSDN here
© 2022 - 2024 — McMap. All rights reserved.