0

I've asked this before but didn't get a good answer and I just cannot believe there isn't one.

If you have a DVWP that references a list you'll get an error message. Is there anyway to customize that error message from the DVWP options? It must be a common issue when you import/export DVWPs and the list you reference does not exist when you import on a new site.

1 Answer 1

0

This is because the DVWPs use GUIDs under the hood and those GUIDs are always persisted across environments dependsing on how you provision or backup and restore.

The best method for portability is to use ListName instead of ListID in the XSLT. I've used this technique many times flawlessly. This allows the DVWP to be exported and moved easily, assuming the list structure is already in place.

<DataSources>
    <SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="<View></View>" id="dataformwebpart1">
        <SelectParameters>
            <asp:Parameter Name="ListName" DefaultValue="My List Name"/>
        </SelectParameters>
    </SharePoint:SPDataSource>
</DataSources>
3
  • I'm using this too but my thought is what if someone imports a DVWP that references a list (by name) that does not exist on the site. Jun 1, 2015 at 14:28
  • There isn't a way to really do that, it isn't any different than if someone exported it with GUIDs. The list HAS to exist first so it can bind. If it can't bind, it is going to throw an error every time. If the user imports it, they'll see right away there is a problem and should delete it. Jun 1, 2015 at 14:30
  • But I think the entire page errors, not just the web-part section so they can't just delete the webpart. Right? Jun 1, 2015 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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