开发者

Add an XsltListViewWebPart to a site defintion homepage

What's the best method for adding an XsltListViewWebPart to a site definition's default.aspx?

I've tried to add one to the definition's default.aspx declaratively by copying the XML from an existing page, but there are a number of references to view and list g开发者_高级运维uids which I won't have until the site is provisioned. The alternative was to programmatically add to the default.aspx via a site provisioned or feature activated event handler, but it's impossible to get a reference to the default.aspx until the site has been created.


Add XML like this to your Module section:

<View List="$Resources:core,lists_Folder;/MyList" BaseViewID="0" WebPartZoneID="Left" WebPartOrder="1" />

SharePoint 2010 will use the XsltListViewWebPart by default. You can still use the old ListViewWebPart with XML as follows:

<View List="$Resources:core,lists_Folder;/MyList" BaseViewID="0" WebPartZoneID="Left" WebPartOrder="1">
    <![CDATA[
    <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
        <Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
        <TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>
    </WebPart>
    ]]>
</View>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜