I had a requirement to display items from a Document library in DataView WebPart and tricky part was to make it portable, so that everytime a site template is created and restored somewhere else, the DataView should not crash.
Solution:
Change the following XSL for DataView WebPart:
1. Update Name="ListID" to Name="ListName"
2. Update ParameterKey="ListID" to ParameterKey="ListName"
3. Update DefaultValue="GUID" to DefaultValue="[List Name]"
in SelectParameters, DeleteParameters, UpdateParameters, InsertParameters and ParameterBindings tags.
<selectparameters>
<webpartpages:dataformparameter defaultvalue="Components" name="ListName" parameterkey="ListName" propertyname="ParameterValues">
</webpartpages:dataformparameter></selectparameters>
<deleteparameters>
<webpartpages:dataformparameter defaultvalue="Components" name="ListName" parameterkey="ListName" propertyname="ParameterValues">
</webpartpages:dataformparameter></deleteparameters>
<updateparameters>
<webpartpages:dataformparameter defaultvalue="Components" name="ListName" parameterkey="ListName" propertyname="ParameterValues">
</webpartpages:dataformparameter></updateparameters>
<insertparameters>
<webpartpages:dataformparameter defaultvalue="Components" name="ListName" parameterkey="ListName" propertyname="ParameterValues">
</webpartpages:dataformparameter></insertparameters>
<parameterbinding defaultvalue="Components" location="None" name="ListName">
</parameterbinding>
This comment has been removed by the author.
ReplyDeleteFor SharePoint 2010:
ReplyDeletehttp://sympmarc.com/2008/12/16/replacing-listids-with-listnames-in-data-view-web-parts/