Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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
share|improve this answer
    
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. –  Spongeroberto Squarepantalones Dec 12 '12 at 14:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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