Thursday, May 16, 2013

This is a strange issue which was happened recently to me when working with Data view web parts in SharePoint Designer.

I have created a page in SharePoint Designer which has the data view web part in it. And I got another requirement where I need to create the same page as the first page with slight change in caml query. So, I have created another ASPX page in designer and copy and pasted the data view web part code from page1 to page2. I saved the page and browsed the page2 and all looks good. Now I browsed page1 and it started showing me empty content (data view web part is not visible anymore on the page.) I have opened the page1 in designer, added the data view web part back on page1 and opened in browser. Now page1 is looking good and page2 is showing empty content. Which means they started working mutually exclusive.

After worked for couple of hours I have learnt that the issue happened was because of the data view web parts sharing the same id. You might think it's a shit reason as the data view web parts are in different pages how that could be the problem. But, yes that is the problem. Believe me. :)

Two data view web parts should not be sharing the same ID whether they are on a single page or in different pages (site pages or pages library).

Once changed the ID and __WebPartId properties of the data view web parts to the new values I started seeing both pages are showing content correct! So, save this tip to your memory for saving hours and hours of time. 

0 comments:

Post a Comment