Question

I am making a webtemplate. This webtemplate activates a hidden feature which contains a module, deploying the default.aspx page.

The module looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="salessiteFiles">
    <File Path="salessiteFiles\default.aspx" Url="default.aspx">
  </Module>
</Elements>

Inside the .aspx page, I have placed a webpart, defined like this:

<SalesWP:SalesWP runat="server" ID="g_b3f403fc_d209_45fd_be6f_6831c665aa1f" ....

When I create a site using my own template, the web part is present, but it appears to be 'ghosted' in some way; the WebPartManager can't find it, and if I open the default.aspx via SPD, the webpartzone is empty. I need to be able to access the webpart via a webpartmanager.

Was it helpful?

Solution

I think that you should not to add web part to the page directly, instead of it you should use web part provision. You can start your research from this posts:

  1. Provisioning Custom WebPart in SharePoint 2010 tricks
  2. Provision a WebPart using a SharePoint Feature
  3. Provision publishing page with webpart in sandboxed solution
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top