Monday, October 12, 2009

Dataview webpart import issue

Scenario:
I use dataview web part very often and recently I faced a weird error.

Steps to reproduce error:
1. Add a ListView webpart
2. Go to SharePoint Designer and Convert to XSLT view
3. I just changed the layout to one of the options available in Display Tab of DataView properties.
4. Save the changes
5. Go to the page and Export the webpart
6. Now import the webpart on the same page.

Boom !!! Error : ViewFlag is not set to right value.

Solution:
While checking the Exported definition, I found this tag.

<ViewFlag xmlns="http://schemas.microsoft.com/WebPart/v2/ListView">9</ViewFlag>
1. Remove the previously added Webpart using Maintainance Page ( ?contents=1 )
2. Removed this tag altogether from the Export definition
3. Again imported it without issue.

1 comments:

Siri June 30, 2010 at 7:22 AM  

There are certain prerequisites to be done before the we completely make webpart reusable

1) Replace the ListID,Name with ListName
2) Remove Guid of the List and replace with your List Name
4) Remove ViewFlag
5) Your List Name

Good Luck!!!