Monday, 30 April 2012

Adding Web Part to Site Defination Default.aspx

Combined with examples from
http://msdn.microsoft.com/en-us/library/gg276356.aspx
http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/858afd94-43cd-451f-87c4-d8530e94af4e
http://stackoverflow.com/questions/234302/how-to-add-a-web-part-page-to-a-site-definition

default.aspx

<%@ Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c"  %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="MyWebPartControls" Namespace="FilteredTaskSite.VisualWebPart1" Assembly="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
    <SharePoint:ProjectProperty Property="Title" runat="server"/>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderId="PlaceHolderMain" runat="server">
<table width="100%">
    <tr>
        <td>
            <View List="108" BaseViewID="0" WebPartZoneID="Left" ContentTypeID="0x012001" WebPartOrder="4" ShowHeaderUI="FALSE"/>
        </td>
    </tr>
    <tr>
        <td>
            <MyWebPartControls:VisualWebPart1 runat="Server" />                   
        </td>     
    </tr>
    <tr>
        <td>
            <WebPartPages:WebPartZone ID="Right" runat="server" FrameType="TitleBarOnly" Title="Right" />
        </td>
    </tr>
</table>
</asp:Content>

onet.xml site

No comments:

Post a Comment