Wednesday, May 2, 2012

Data View Web Part, The Basics - Insert a DVWP on Your Page


Current average rating is 5 stars. Press SHIFT+ENTER to rate this item.1 star selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+ESCAPE to leave rating submit mode.2 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.3 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.4 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.5 stars selected. Press SHIFT+ENTER to submit. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.
Categories:SharePoint Designer; Data View Web Part; Data View Web Part Basics; Site Manager/Power User; MOSS; WSS; 2007; 2010
From Mark Miller: Laura Rogers is teaching a live online workshop this Friday: Getting Started with the Data View Web Part. The series of articles starting with the one below, will go over the basics of DVWPs and show how you can build powerful, data run solutions with your existing sites. If you like what you see over the next few days, register for the workshop and get your hands dirty!
Articles in this Series As I mentioned in my previous article, I am writing a series on the SharePoint 2007 data view web part (DVWP).  These web parts can only be created using SharePoint Designer (SPD).  Now that SharePoint Designer 2007 is free, this opens the door to a lot more people being able to create these web parts, widening the intended audience for these articles.  So let's get started with the basics:
  1. In SharePoint Designer (SPD), click <File> and choose <Open Site>.  Paste the full URL of your SharePoint site, such as http://sharepoint/sites/teamsite
    Notice that I left out the "default.aspx" at the end of the URL.
  2. Click <Open>
    You can see that the left side of the screen shows the folder structure of your site.  Each document library is a folder, and all of the site's lists live under the "Lists" folder.  At this point, the best way to start creating a data view web part (DVWP), is on a blank web part page.  Go to the site in your browser, and create a web part page:
  3. Click <Site Actions> and <Create>.  Choose "Web part page", give it a name, pick a document library to put it in, and click <Create>.  Make a mental note of which doc library you picked.  At the top right, click <Exit edit mode>
  4. Now, in SPD, on the left side, navigate to the new web part page by clicking on the name of the document library from step 3.  The contents of that library will be displayed in the main work area in the middle of the SPD screen.  If you don't see your new file, click the F5 key to refresh the list.
  5. Double-click the name of the new file to open it. 
    Now, it's time to start picking a data source to insert a data view web part.  You see the web part zones displayed on the page, and each zone says "click to insert a web part".  It's important at this point, that you pick a web part zone, and click <Click to insert a web part>.  If a zone is not clicked on, a web part that's inserted could end up on some random spot on the page.
    Data View Web Part Basics
  6. Click the <Data View> menu at the top of the screen, and choose <Insert Data View...>. 

    Since this initial article is really just to show you around in the DVWP, we're not going to do anything fancy.  We'll just insert a regular SharePoint list as our data view.  See, that now on the right side of the screen, there is a "Data Source Library" pane.  The following are types of sources that you can get data from:
    • SharePoint Lists
    • SharePoint Libraries
    • Database Connections
    • XML files
    • Server-side scripts
    • XML Web services
    • Linked Sources
    Data View Web Part Basics
  7. As an example, let's grab some data that�s in a list on the site.  In the "SharePoint Lists" section, pick a list (preferably one with some data in it).  Click the drop-down box on that list name, and choose <Show Data>.
  8. Now, in the pane on the right side of the screen, instead of the "Data Source Library" tab, you'll see the "Data Source Details" tab, that shows the details of the source that was just selected.  This means, that all of the fields in the list are displayed.  There are even some extra fields listed there, that are usually hidden from views.  While holding your CTRL key down, click on three or four field names to select them.
  9. Click <Insert Selected Fields As...> right above those field names.  Choose <Multiple Item View>.  In various articles of this series, I'll go over some of these other options, but this one is the most commonly used.
  10. When the DVWP is first inserted, the "Common Data View Tasks" menu is automatically displayed. 
Data View Web Part Basics
Future articles will go into detail about configuration options such as the ones in this list.  Stay tuned.

No comments:

Post a Comment