1

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.

2

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
  • That appears to work! At first I wanted to avoid this method because I read a blog post saying that the ID property of the web parts didn't work (and I need that ID for the webpartmanager) but everything appears to be in order. – Kenneth Van Coppenolle Dec 12 '12 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.