1

I'm using Sharepoint Foundation 2010. I'm trying to include announcements from my parent site in my subsite's announcement list. Or atleast in a separate list/webpart above it. If its not possible to completely integrate them together or just inherit the parent announcements in the child's I'd like to just show the 5 most recent parent announcement titles linked to the actual announcements and then maybe a show more button that links to the parent announcement list itself.

I have very very little experience with ASP.net and Sharepoint in general. Sadly I'm unable to use CQWP - that seemed to be able to do what I want to do very easily. I tried using DataView and had no luck. I tried the "VG Content Display" webpart on Codeplex but I could only get it to work with documents not announcement content type for whatever reason. Yes I changed the data type values and such.

I really need to figure this out soon! Please someone tell me the best way to do this with little experience.

1

It could be achieved via XsltListViewWebPart (XLV) web part. Basically all you have to do is to specify/update WebId property for XLV web part.

Limitation: it works withing a site collection only

Below id demonstrated how to configure XLV to display list from a sub site using SharePoint Designer (SPD)

Steps

  • open source site in SharePoint Designer (SPD) and go to View page for a list/library
  • open the page in edit mode and copy XLV declaration:

    <WebPartPages:XsltListViewWebPart ...>
    <!-- the remaining code is omitted for a clarity -->
    </WebPartPages:XsltListViewWebPart>
    
  • open target site via SPD and go to the page where you would like to host XLV
  • paste the specified XLV declaration into the web part zone
  • find WebId attribute and specify Web Id of source site
0

I have used the webid tip in the past but it is not something I would use as a general practice. SPD is quite buggy in this matter. (still is a nice workaround)

I would recommend creating something like a User Control that can receive the web url and listname as parameters and render the results as required. This will not only overcome the multi-site problem, but will also provide a resusable, fully customizable solution for the future.

using (SPSite site = new SPSite(<url to spweb>))
{
      using(SPWeb web = site.OpenWeb())
      {
         SPList announcementsList = web.Lists.TryGetList(<name of list>);
         // put your code here ...
      }
}

More info,

http://msdn.microsoft.com/en-us/library/ee231548.aspx

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.