what's the best practice to display tabular / Grid data in Sharepoint 2010?
-
16-10-2019 - |
Question
We can develop a custom control in Visual studio and deploy it as a webpart to use in SP.
but I head of some other ways, so can you please list possible ways to achieve this? and what's the pros and cons of each?
Solution
Well, ultimately you can do anything you could do in ASP.NET - so there are a huge number of options.
Likely candidates include:
- List View Web Part (Shows data from a table. Pro: easy. Con: limited in control of display)
- Data View Web Part (Shows data from a variety of sources. Pro: easy, more control. Con: harder to deploy, in my experience.)
- The SPGridView control (Build into page, web part, user control or web control) (Pro: Gives a nice "SharePointy" looking grid, very like the normal GridView control. Con: You actually have to code it)
I'm guessing that actually what you're asking is should you go for a web part or web control, or user control. Well, that's already been asked, but my thoughts are:
User Controls are good, and Visual Web Parts in 2010 are just wrappers around User Controls.
In WCM sites, or sites where user's shouldn't be able to 'control' how the page looks themselves, User Controls or Web Controls are the way to go. User's can't change them; they are restricting.
In sites where users do need to be able to control how the page looks - like collaboration sites - then I'd suggest going for web parts.
Does that help?