Click here to Skip to main content
Click here to Skip to main content

Tagged as

SharePoint - Hiding Webpart div

, 20 Dec 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
How to hide the HTML tags that surround a web part (SuppressWebPartChrome)

Introduction

When adding a DataFormWebPart web part in SharePoint, the following HTML is created by SharePoint when the page is rendered (or something similar to it).

<TABLE border=0 cellSpacing=0 cellPadding=0 width="100%" TOPLEVEL>
<TBODY>
<TR>
<TD vAlign=top>
<DIV id=WebPartWPQ2 allowDelete="false" 
OnlyForMePart="true" width="100%" HasPers="true" 
WebPartID="00000000-0000-0000-0000-000000000000">
<!-- html rendered by web part -->
</DIV></TD></TR></TBODY></TABLE>
<IMG alt="" src="/_layouts/images/blank.gif" 
width=590 height=1> 

Background

This code is tested in SharePoint 2007 with the DataFormWebPart.

Using the Code

In SharePoint Designer, add the SuppressWebPartChrome="True" property:

// Example

<WebPartPages:DataFormWebPart SuppressWebPartChrome="True"  

When this property is set, the outside Table and Div tags will not be rendered by SharePoint.

This has been specifically helpful for .css renderings where embedded Divs and Tables can get thrown off.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Jay Guiang
Architect GuiangStar Corp
Canada Canada
.in the MS development game for 14+ years.
Follow on   LinkedIn

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.1411028.1 | Last Updated 20 Dec 2013
Article Copyright 2013 by Jay Guiang
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid