3 Reasons to Use Tables Instead of ASP.NET MVC Webgrids
With the absence of WebGrids in ASP.NET Core, developers are looking for alternatives. Today, we'll cover 3 reasons why we could use tables instead of WebGrids.
Join the DZone community and get the full member experience.Join For Free
But we're in a different world now, aren't we?
There's a new version of ASP.NET called Core (version 1.1 at the moment) and for those who want to transition their old projects over to ASP.NET Core, you may be wondering what happened to the WebGrid.
Heck, I was wondering where it went.
I'm in the process of converting a project of mine over to ASP.NET MVC Core. I use WebGrids all over the place for tabular data (NOT layout!), but I couldn't find WebGrid.
I found out it's missing from Core.
OMG! What am I to do? This is HORRIBLE!
Even though it's missing from Core, to be honest, would this be a bad thing?
Today, I discuss three reasons why tables may make a comeback (and I talk myself off the ledge).
1. WebGrid is Not Flexible Enough
Now, while I've always loved how the WebGrid works, I experienced some warts with the code. I mentioned these warts in a post called Creating a Responsive WebGrid in ASP.NET MVC.
It seems the WebGrid isn't granular enough.
In an HTML5 world, I can't add a simple "data-" attribute to something. It has to be a class. End of story. I can't add custom attributes to a table row (TR) or table data (TD).
When you also have hard-coded HTML in the library, I tend to raise an eyebrow suggesting something isn't right.
2. No WebGrid Library Is Available for ASP.NET Core
I've got a gut feeling that the majority of developers out there are already working through this. They are moving forward without a WebGrid.
I've looked around for ASP.NET Core WebGrids and the closest thing I found was NonFactors's WebGrid which is open-source and pretty solid.
In this post, I explain why it may be better to move back to tables instead of looking for a WebGrid replacement library to "rule them all." Are the old table tags "new" again?
Post your thoughts below as to whether we need WebGrids or not.
Published at DZone with permission of Jonathan Danylko, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.