Default web part in web part zone for page layout

  • Default web part in web part zone for page layout eirikb

    How can I set a web part so it will be automatically appended to a web part zone when a specific page layout is selected?

    The solutions I have tried so far is:

    1. Using <ZoneTemplate> under <WebPartZone> and putting my webpart in there
    2. Adding .webpart-code directly into <AllUsersWebPart> where I define the page layout, in elements.xml
    3. Put the web part on the page layouts programmatic when creating site structure (deployment script)
    4. Add a hook that hooks in and adds the web part

    Problems with the solutions:

    1. The web part seems to become static, and can not be removed after it's created.
    2. would have to put .webpart-code in both a .webpart-file as well as in elements.xml (I want it to be stand alone as well as set by default). And making a mess in my elements.xml.
    3. Web part will only be deployed first time, so when creating a new page with the page layout, the web part will not be included.
    4. We do not know how to do this, since page layout is set after creating the page. We do have hooks for setting default page layout based on where in the structure the page is created, here we can append the web part as well, but then the web part will only be added if you create a page on a specific location.

  • Since you are using SP2010 you should be able to use the WebProvisioned event to hook in extra functionality such as the one you ask.

    In SP2007 I would use any of the above methods you mention depending on what i needed. The last one I would achieve by using a custom provisioning provider. Check out my other post on this here.

Related questions and answers
  • , and then as part of that activation, drop web parts onto some specific pages. In my case I want to be able to drop it onto the "AllItems.aspx" page of a list, but I'm equally having trouble adding...: No go. You cant use the SPLimitedWebPartManager class, and the SPWebPartManager class works only within the context of the page where its instantiated. So bascially, you cant do this in code. XML...), then there doesn't seem to be a way to just get a reference to the page, it always wants to overwrite it with a new file. But I dont want to do that, I just want to add a Web Part to the existing page. See my

  • " maxRequestLength="104856" /> After searching I found Well, obviously I cant use GET because I am developing a web part NOT a page. Also, it is not possible to oblige the clients to change their forms from POST to GET just to use my little web part (I think you understand me). I put a breakpoint inside the web...-scope is only within the web part NOT the full page. Also, I do not want to use any AJAX-controls. Update: I was told that the only way to get rid of "Webpage has expired" error is either by: Using

  • I've created a Custom List ('Tooltips') in SharePoint. After this I used SPSource to reverse engineer the list into a feature. After installing and activating this feature, I want to add this list in a WebPart zone. When doing this, I get an error message : Tooltips: List View Web Part could not be added, list may be hidden. What's wrong with the list? feature.xml &lt;?xml version="1.0" encoding="utf-8"?> &lt;Feature Id="70d49f3d-233a-482d-97e3-dcec2c236171" Title="MyApp - Tooltips" Description="Creates a Tooltips list which can be used for mouse-over texts

  • --------------------------- Things I have tested: I can successfully upload my .webpart definition to the web part gallery, and the web part works. I can successfully add the web part to the page... correctly for the Content Editor Web Part (based on sample code), however when I replace the Content Editor Web Part definition with one for my own web part I get the following error... getting a "Cannot Import Web Part" error. I think this is heading in the right direction, not sure if I have an issue in my .webpart file.

  • Scenario: We have an internal application that ties Excel spreadsheets stored in a SharePoint doc lib with specific Opportunities in CRM. The user clicks on a button in the Opportunity and a Web... is causing this behavior? I can change the code to avoid it if I can figure out why it is happening. Is there any way through the SharePoint UI or APIs to "release" the document so that the original... to them by SharePoint as read-only (so they will get the above error message). However, often they are demonstrably the only user to have accessed the document - in fact, sometimes this will happen

  • Full disclosure: Sharepoint development noob. I currently have 3 custom web parts built in an SP solution in VS2010. I build and deploy my project out to our local Sharepoint dev box. However, after deploying, only the first 2 custom web parts show up under the Custom category in the "insert web part" ribbon section. I checked the elements.xml file for all 3 webparts, they're all set up to be listed under the custom group. Any ideas on how I can debug this? Any constructive advice is greatly appreciated. Home elements.xml &lt;?xml version="1.0" encoding="utf-8"?> &lt;Elements xmlns

  • I have a web part which I am trying to target to a specific audience (the 'Staff' audience.) I have the web part in the home page of a site that has anonymous access enabled. I have set the Target Audience of the webpart to 'Staff'. The idea is that anonymous viewers can't see the web part, but logged-in members of staff can see the webpart. This works fine, as long as I am browsing the site from the server on which SharePoint is running, using the internal domain name (e.g. http://localhost:5050/site). If I view the site home page while not logged in, I can't see the webpart

  • and this two sub sites have different set of user. So to summarize my question. I want to get as result of SQL query table with username (NT\login) with information about... have list of sites and sub-sites with URL's. More details: Let me describe one solution I have now. I’ve found tool Data Juggler ( which can automate repetitive web tasks. This means that I’ve prepared list of all sites/sub-sites in my scope. As a source I use spreadsheet with all details about sites/sub-sites input.xlsx this is only one part of process maintained

  • Scenario: User has 'Contribute' rights on a List. User creates a new ListItem on this List. User should only be able to edit or delete his own ListItems. How can I define that only the Owner (Created By) should be able to edit or delete this ListItem ? I was thinking about using an xslt if-statement with: ddwrt:IfHasRights(...) 'Created By' == 'Current User' Is this correct ? Or are there easier ways to do this ? See this page for a complete overview from all Rights.

Data information