Override Chrome Type Webpart

sharepointsharepoint-2010web-parts

I made a Webpart in Sharepoint 2010, and I need that the property "Chrome Type" allways set a "None" value.

I was looking for ways to force the Combobox to "None", or overriding the "Chrome Type" in the C# class, but I didn't find any way to do them. What is the best way to set this property?

Override Chrometype

Best Answer

The other option is to use the .webpart file to specify this as the default using the ChromeType property. You can do this in your Visual Studio solution (as below) or you can edit the .webpart file directly in the Web Part Gallery.

As this is a no code approach, it seems a bit simpler than the C# route.

Try this:

<?xml version="1.0" encoding="utf-8"?>
<webParts>
  <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
    <metaData>
      <type name="<<ClassName>>, $SharePoint.Project.AssemblyFullName$" />
  <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
</metaData>
<data>
  <properties>
    <property name="Title" type="string">Custom List Form</property>
    <property name="Description" type="string">Provides A Data Entry Form For a SharePoint List</property>
    <!-- SEE CHROME TYPE BELOW -->    
    <property name="ChromeType" type="chrometype">None</property>
  </properties>
</data>
</webPart>
</webParts>
Related Topic