Disable the toolbar header on a listviewwebpart from code

A few weeks ago I helped out on a project creating some featureeventreceivers to dynamically add webparts to pages. Because of time-restrictions I didn't have the time to look into a weird problem we encountered..

We experienced a problem when adding a listviewwebpart from code in which we don't want to display the toolbar. (aka toolbar = none from the Edit Shared Webpart menu).

Now, my fellow team-system-guru Marcel 🙂 decided to turn over to the wonderful world of SharePoint and came up with a solution!

On his blog he posted the code-snippet to effectively remove the toolbar from a listviewwebpart. The solution looks like a hack..but apparently this is the only way to achieve this..

Read it here: click

 

Great work Marcel!