Data View Web Parts

November 14, 2004 at 7:16 pm | Posted in SharePoint, SharePoint 2003 | 4 Comments

Although in my last post I mentioned SharePoint from the project management perpective, here's a tip that's purely development.

One thing that winds me up is how SharePoint deals with ghosted pages. As soon as a page is unghosted it's lost to any future template changes. If you unsure to what unghosted pages are in SharePoint let me assure you they are "a bad thing".

Now should you wish to create a data view web part from an existing list, you have to do it in FrontPage, and you have to then hit the save button, unghosting it and casting the page down in to the 7th circle of SharePoint annoyances.

Unless…

You first create a new web part page, and place your list as a web part on that new page. Then in FrontPage convert it into a Data View web part and do all the customisations you wish. Once done, hit save.

Then visit the page in Internet Explorer. Modify the properties of the data view web part and you'll see the three buttons in the toolpane that displays the properties on the data view web part (Source Editor, DataQuery Editor, Parameters Editor). Open each property window and copy and paste the values to 3 local text files.

You can now delete the web part page and the data view web part it contains. (Although I'd recommend waiting until you know this whole process has worked)

Now go to the page you really want to display the data view web part on.

Drop an empty Data View web part in to a zone. Open the toolpane, and for each property button paste in the values from your local text files.

You'll now have your customised Data View web part, and no unghosting will have taken place!

High-five!

What’s that? You don't have an empty Data View web Part? Ah.

Right-click save target as on http://gilesgregg.com/Data%20View%20Web%20Part.dwp.

Copy it in to your wpcatalog folder under the sites’ root iis folder and you'll then find it under the Virtual Server gallery.

Alternativly you could export the web part to a .dwp file off the temporary web part page and then import it to the destination page. This is certainly an easier method in the short term, but I've found having an empty data view web part in the Virtual Server gallery quite useful.

Any feedback gratefully received…

Advertisements

4 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Why don’t you just export the webpart from the un-ghosted page, and then import it into the new ghosted page? That will save time and effort having to manage three separat property strings…

  2. I mentioned that export/import option at the end of my article, and it certainly is easier. However, I think learning exactly how the Data View web part works is a useful exercise.

  3. Hi,
    I added the data view web part to the page, however i got an error “the list does not exist…”
    Is there away to solve it?
    10x
    ariel

  4. This is a very nice tip , only problem with it is It doesnt allow the use of link to item on the dataview Id like to be able to pull all active tasks from another site and be able to link directly to them in the data view.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: