In my ONET.XML module I wat two views on one list

by Bas Hammendorp 21. December 2009 07:56

In a recent project I wanted to show two views of one list. The problem is that by default the title of the List node is copied into title[1] and title[2]. To solve this, you must include the <webpart> in the view element. So I opened the ONET.xml of the site definition. In the Configuration/Lists section I added my list feature:

<Lists>
 <List FeatureId="&lt;myGuid>" Title="My List" Type="12345" Url="Lists/MyList" />
</Lists>

Then in the Modules/Module/File section in the ONET.xml we need to add the View element:

<View List="Lists/My List" BaseViewID="1" WebPartZoneID="Header" WebPartOrder="1" Type="HTML">
 <![CDATA[
  <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
   <Title>My first custom title</Title>
   <Assembly>Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
   <TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>
  </WebPart>
 ]]>
</View>


<View List="Lists/My List" BaseViewID="2" WebPartZoneID="Header" WebPartOrder="2" Type="HTML">
 <![CDATA[
  <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
   <Title>My second custom title</Title>
   <Assembly>Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
   <TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>
  </WebPart>
 ]]>
</View>

As you can see, in the CDATA you can find an element Title which you can use for your own custom title!

Have fun!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Sharepoint

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About the author

My name is Bas Hammendorp, I work as an Enterprise Engineer at PGGM. My specialties are ASP.NET, C#, SQL and Sharepoint 2007.

Google ads