1

I have a page with a DataFormWebPart setup to display some data from a subweb. The page is setup ok, the webpart is working. In my solution, I need to create the subweb (that's already working ok) and then place the DataFormWebPart on the default page of the current site.

I was trying to do this declaratively via a module, but that doesn't seem to work. I've tried this approach:

<Module Name="MyOrgPages">
<File Path="MyOrgPages\Home.aspx" Url="SitePages/Home.aspx">
  <AllUsersWebPart WebPartOrder="0" WebPartZoneID="Left">
    <![CDATA[<?xml version="1.0" encoding="utf-8"?>
      <webPart>...</webPart>
    ]]>
  </AllUsersWebPart>
</File>

But SharePoint keeps complaining it doesn't understand the content of the webpart. I got the contents by exporting the webpart to a .webpart file and copying the contents of that file.

So is this actually the correct way to do this, and if so: what could be the cause of my problem?

1

Ah stupid. You need to include <webParts> </webParts> inside the CDATA bit, otherwise it doesn't work.

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.