Friday, March 14, 2008

Hide Web part title


There are two ways to hide the Title of a particular web part:
1) Modify the *.webpart file.
By changing the settings related ChromeState and ChromeType we can hide Title.



<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<data>
<properties>
<property name="ChromeState"
type="chromestate">Normal</property>
<property name="ChromeType" type="chrometype">None</property>
</properties>
</data>
</webPart>
</webParts>





2) Modify the Web part settings by SharePoint site.
a) Click "Modify Shared Web Part" menu.




b) Select "Chrome State" as "Normal" and "Chrome Type" as "None".




3) So the final result of changes will be…




Note: Some others interesting Web part properties are:





<webparts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<data>
<properties>
<property name="AllowMinimize" type="bool">False</property>
<property name="AllowClose" type="bool">False</property>
<property name="AllowEdit" type="bool">False</property>
<property name="ShowActionLinks" type="bool">False</property>
</properties>
</data>
</webPart>
</webparts>




Properties names are self-explanatory.


3 comments:

Ashish Kanoongo said...

Hello Avinash

Can you give me your email id or phone? I have some queries related with Sharepoint search and infopath list?

Mαkαrαηd Theηgdi's Bℓσg said...

Hi.. Myself Makarand

the information which u have given is correct. I am also doing the same but programmatically..

After doing this the title & border disappears but the problem is that some blank space is generated in place of Title. I dont want this blank space.

Do you hav any solution for this
If yes then do mailto: makarandthengdi@gmail.com

Thanx in adv
Mak

Avinash said...

Hi Makarand,

Try this code...

using (SPSite site = new SPSite("site"))
{
using (SPWeb web = site.OpenWeb())
{
SPLimitedWebPartManager manager = web.GetLimitedWebPartManager(“url”,System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
foreach (System.Web.UI.WebControls.WebParts.WebPart part in manager.WebParts)
{
part.ChromeType = PartChromeType.None;
try
{
manager.SaveChanges(part);
}
catch (Exception e)
{ }
}
}
}

Google