Tuesday, July 19, 2011

Create a Polling Web Part with SharePoint Designer and the DVWP

Create a Polling Web Part with SharePoint Designer and the DVWP


Guest Author: PatCharles Iovanella
As a continuation of my Best of EUSP article I was asked to expand on the Polling Data View Web Part.  As I stated in my article, �SharePoint surveys leave a lot to be desired, especially from the end user perspective. What if you want to ask only one question and do not want users to leave the current page?  A SharePoint survey is not the answer. But you can use the SharePoint survey and create a custom polling web part via SharePoint Designer and the Data View Web Part. You can turn a one question SharePoint survey into a cool looking Polling Web Part.�
So let�s get to it!  I�m making a few assumptions that you know how to use SharePoint Designer and are able to complete all the steps without any further elaboration.
  1. Create your one question SharePoint survey
  2. Create a new Demo page using the Web Part Page template. This page will be our sandbox for building the polling web part.
  3. Open SharePoint Designer and then open your new Demo page
    1. Click into any Web Part Zone
    2. Insert Data View Web Part- Data View - Insert Data View
    3. Select the correct Survey Data Source
    4. Select the one question field
    5. Insert Selected Fields - New Item Form
    6.  
    7. Highlight both columns together, right click, Modify - Merge Cells
    8. So, now we have consolidated our survey into a small compact DVWP.  So let�s create a voting button.
    9. Delete the Cancel button and double click on the Save button
    10. Change the Value/Label to �Vote�
    11. Save Demo page and view in browser
  4. From the Demo page, export the Polling Web Part to your desktop
  5. Import the Polling Web Part and add to your page.
  6. Done!
Now, if you want to take it a step further and add the Graphical Summary responses, you can do that too. I used Christophe Humbert�s Cross List jQuery script to expose the SharePoint survey summary.aspx on the same page as my poll web part. This way every time some takes the poll the page refreshes and displays the real-time poll results. Please refer to Christophe�s instructions in the links provided.

http://blog.pathtosharepoint.com/2009/03/23/display-a-list-in-another-site-contd/
http://www.pathtosharepoint.com/sharepoint-user-toolkit/Pages/Cross-Site-List-Snapshot.aspx

Item is currently unrated. 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.

No comments:

Post a Comment