Saturday, March 10, 2007

DVWP issue with site template

Data View WebParts are binded with the site names implicitly. So when you create a site template out of the site that has the DVWP, there will be an issue. New sites provisioned from the site template will fail to load due to the reason that the site name is different.

Fix:
Replace the code with the following. In the below code, replace the 'Your List name' value with your actual list name.

< SelectParameters>
<WebPartPages:DataFormParameter PropertyName="ParameterValues" ParameterKey="ListName" DefaultValue="Your List name" Name="ListName">




<DeleteParameters> <WebPartPages:DataFormParameter PropertyName="ParameterValues" ParameterKey="ListName" DefaultValue="Your List name" Name="ListName">


<UpdateParameters> <WebPartPages:DataFormParameter PropertyName="ParameterValues" ParameterKey="ListName" DefaultValue="Your List name" Name="ListName">


<InsertParameters> <WebPartPages:DataFormParameter PropertyName="ParameterValues" ParameterKey="ListName" DefaultValue="Your List name" Name="ListName">


<parameterbindings> <ParameterBinding Name="ListName" Location="None" DefaultValue="Your List name"/>

<ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>

<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>

<ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>

1 comment:

  1. i think u meant list template ?? right
    http://snahta.blogspot.com/2008/09/listid-fix-for-listview-webpart.html

    ReplyDelete