FrontPoint

Using Microsoft FrontPage to do amazing things with SharePoint Products and Technologies

  • DataViewWebPart RunTime documentation

    Hey everyone,

    Sorry to be so lax in my postings. I was really busy getting ready for PDC and now Beta1 for Office looms somewhere on the horizon. Please check out Rob Mauceri's blog on our plans moving forward.

    Additionally, check out this article on MSDN which documents the DDWRT (data driven web runtime) functions available in the DataViewWebPart. This was done with a lot of work from Serge Van Den Oever as well as our dev team.

    Thanks!
    -John

  • Editing items inside Nested Document Libraries

    I just found something pretty interesting about using a Data View Web Part to view items in a Document Library that contains folders. Without going into all the technical details, essentially the "Edit" link will return an "Item not found" error for any documents inside the subfolders.

    If you ever see this error, and you are positive the item does exist, the most likely cause for error is that the URL does not contain the RootFolder attribute. As an additional side note, for some reason the DataView converts the EDIT link into the DISPLAY link, so there are two issues here that I will show you how to fix.

    First, for the repro: Browse to the Shared Documents document library in the browser. Create a new document called docOne.doc. Create a new folder called FolderOne and browse to this folder. Create a new doc in this folder called docTwo.doc.

    Next you want to open the site in FrontPage and create a new WebPart page. Then click Data..Insert WebPart. Choose the Shared Documents web part and insert it.

    After it is inserted, right click it and choose List View Properties. Click Fields and add the Edit field. Then right click the List View and choose "Convert to XSLT Data View".

    Save the page and preview in browser.

    You should notice that if you click to edit docOne.doc, you see the Display form (which is wrong)

    If you click to edit docTwo.doc, you will see an item doesn't exist error (which is also wrong)

    So, back to FrontPage to fix this:

    In code view for the page where the DataView lives, find:

     

    <a href="{$URL_DISP}?ID={@ID}" onclick="GoToPage('{$URL_DISP}?ID={@ID}');return false;" target="_self">

     

    And replace it with this:

    <a href="{$URL_EDIT}?ID={@ID}&amp;RootFolder={@FileDirRef}" onclick="GoToPage('{$URL_EDIT}?ID={@ID}&amp;RootFolder={@FileDirRef}');return false;" target="_self">

     

    That should do it. Have you seen other problems with Document Libraries? Let me know (the fact that the folders don't show up in the above scenario is already known and is unfortunately by design...)

    -John

  • Creating a Link using a Lookup field

     

    Hi,

     

    I was just asked a great question: "How do I create a hyperlink when using a Lookup field that points to the item for that lookup field..."

     

    This is not completely straightforward, so bare with me. In this example, I am using the Announcements list and the Contacts list. In the Announcements list I created a lookup field the LastName value in the Contacts list and have created a few announcements with the LastName value in them.

     

    1. I need to get the List Id of the Contacts list. You can use the web service for this, but I find it much easier to simply drag the Contacts list onto a new page in design view, switch to code view, and Find '@ID' and then grab the list ID (it is a GUID). Then I close that page without saving it.

     

    2. Create a new page

    3. insert a view of the Announcements list including the Lookup field 4. select the Lookup field data value 5. Insert > Hyperlink 6. type the following into the URL address field:

    http://server/subsite/Lists/Contacts/dispform.aspx{ddwrt:URLLookup('{LIST-GUID-FOUND-IN-STEP-ONE}', 'lookup', string(@ID))}

     

    (NOTE The nested {} around the GUID).

    My URL looks like this:

    {ddwrt:URLLookup('{BBD5C595-B540-4839-AAAF-7FB2555A0960}', 'lookup', string(@ID))}

     

    7. Save the page

    8. switch back to code view and find "mailto:"

    9. Delete this. It is a bug that when your URL has an @ symbol in it, FrontPage adds the mailto: code...goofy, but should be fixed in the next release.

    10. save the page again

    11. Preview in the browser

    12. click the Link

     

    NOTICE: You should be directed to the dispform.aspx page and see the contact information.

     

  • Totals in the DataView when the View is Filtered

    Hello again,

    We are chugging along with the next version of Office and are super busy around here trying to get the right features into the next version of the Data View and SharePoint customization story. That said, I was looking through some older posts and saw this one:

    http://blogs.msdn.com/frontpoint/archive/2004/04/30/123982.aspx

    from Rob. This is a really cool feature for showing the count of items in your view. However, this count is not accurate once you start using Ad Hoc filtering. This post is about extending the above example by making a minor edit to the XSLT in code view.

    So....

    • Create a Data View of some data source (I'll just assume you know how if you're still reading this post)
    • Click on Data then Style
    • Enable the default toolbar and the Show View Footer checkboxes on the Options tab and click OK
    • Drag some data value into the View Footer and use the OOUI to change this to a COUNT (this is how far the above article gets you, this next step is the Money step)
    • Switch to code view (this next part is a little complicated - you are going to modify the View Footer XSLT and then move the code that says where to display the View Footer*)
      1. Click Edit and then Find
      2. find the following: dvt_1.footer
        • the code should look like this:
        •                     <xsl:call-template name="dvt_1.footer">
                                  <xsl:with-param name="Rows" select="$Rows"/>
                              </xsl:call-template>
      3. select this code and CUT
      4. Click Edit and then Find
      5. find the following: groupend
        • the code should look like this:
        •                     <xsl:variable name="groupend"><xsl:value-of select="ddwrt:NameChanged('', -1)"/></xsl:variable>
                               </xsl:if>
                               </xsl:foreach>
                               </xsl:template>
      6. paste in the code from step 2 immediately after the </xsl:foreach> so it looks like this:
        •                     <xsl:variable name="groupend"><xsl:value-of select="ddwrt:NameChanged('', -1)"/></xsl:variable>
                          </xsl:if>
                      </xsl:for-each>
                              <xsl:call-template name="dvt_1.footer">
                                  <xsl:with-param name="Rows" select="$Rows"/>
                              </xsl:call-template>

                  </xsl:template>
      7. click Edit and then Find
      8. Find the following (again): dvt_1.footer
        • The code should look like this:
        •         <xsl:template name="dvt_1.footer">
                      <xsl:param name="Rows"/>
                      <table cellSpacing="0" cellPadding="4" border="0" width="100%">
                          <tr>
                              <td class="ms-vb"><xsl:value-of select="count(/dataroot/Categories/CategoryID)"/></td>
                          </tr>
                      </table>
                  </xsl:template>
      9. Remove the <table> code so it looks like this
        •         <xsl:template name="dvt_1.footer">
                      <xsl:param name="Rows"/>
                          <tr>
                              <td class="ms-vb"><xsl:value-of select="count(/dataroot/Categories/CategoryID)"/></td>
                          </tr>
                  </xsl:template>
      10. Change the Count code so it references a variable rather than a literal path
        •         <xsl:template name="dvt_1.footer">
                      <xsl:param name="Rows"/>
                          <tr>
                              <td class="ms-vb"><xsl:value-of select="count($Rows)"/></td>
                          </tr>
                  </xsl:template>
    • Save the page and preview in the browser
    • Change the Filter and you should see the count change

    I am hoping this will be much easier in the next release.

    -John

    *technical details: our design is to put the view footer outside the body template that displays your data. Because of this, the scope of the $Rows parameter is outside the current Repeating Data Region. What we have to do is move the scope inside the current RDR. In doing so, we need to delete the <table> code so it will be valid HTML.

       

  • Serge van den Oever

    I just came across Serge's Blog last night and wanted to link to it, but also wanted to get some feedback. I've been working on documenting all the DDWRT functions the come with the DataViewWebPart, when much to my surprise, Serge had already a good job of it himself.

    http://weblogs.asp.net/soever/archive/2005/01/03/345535.aspx

    I was hoping to get some feedback about whether this information is useful, high priority, necessary...any comments at all.

    Thanks!

    -John

  • Some Behaviors may not be restored even though you check the button to "Restore onmouseout"

    This one is really more of a KB article topic than SharePoint specific, but I was asked this question by a SharePoint developer who uses a lot of DIVs, so I thought I'd post it here.

    If you use FrontPage Behaviors to do things like change the background color of a layer, or change the style of a font tag using onclick or onmouseover commands, and you also want to restore the style onmouseout or onblur, you may find that the style is not restored properly in certain cases.

    These cases are when the style is set as part of the style attribute. For example, if you have:
    <DIV style="background-color: red;">this is in the div</DIV>

    And you use FrontPage's behaviors to change the color to black onmouseover, it will not turn back to red onmouseout even though you check the box for it to do so.

    The workaround if pretty simple, but also very hard to figure out, so here it is:

    In code view, use Edit > Find to find the following code in the restore javascript function:

    eval("x."+x.n+"=x.v"); }

    and change it to:

    eval("x."+x.n+"=String(x.v)"); }

    That should do it for you.

    -John

  • Selecting unique values in a Drop-down list using the Data View Web Part

    I posted awhile ago about how to select unique values for tabular data views, but I have now received a few emails asking how to do it for drop-down lists. It is almost the exact same code, but apparently this is confusing enough to warrant a different post.

    My code sample assumes you are using the default Announcements list on SharePoint and that the Title field is what you want to display.

    First, browse out to your Announcements list (which you get by default when you create a SharePoint site), and add a few Announcements all with the same title (just for demonstrations sake :-))

    Then...

    1. Insert a Data View Web Part based on the Announcements list
    2. Click Data..Style and change to the drop-down view style..OK
    2. Probably best to switch to code view at this point
    3. Find the code that looks like this:
    <xsl:template name="dvt_1.body" xmlns:ddwrt="
    http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
                <xsl:param name="Rows"/>
                <xsl:param name="FirstRow"/>
                <xsl:param name="LastRow"/>
                <xsl:for-each select="$Rows">
                    <xsl:variable name="KeepItemsTogether" select="false()"/>
                    <xsl:variable name="HideGroupDetail" select="false()"/>
                    <xsl:variable name="GroupStyle" select="'auto'"/>
                    <xsl:if test="(position() &gt;= $FirstRow and position() &lt;= $LastRow) or $KeepItemsTogether">
                        <xsl:if test="not($HideGroupDetail)" ddwrt:cf_ignore="1">
                            <option style="display:{$GroupStyle}">
                                <xsl:value-of select="@Title"/>
                            </option>
                        </xsl:if>
                    </xsl:if>
                </xsl:for-each>
            </xsl:template>

    4. Change that code to look like this:
    <xsl:template name="dvt_1.body" xmlns:ddwrt="
    http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
                <xsl:param name="Rows"/>
                <xsl:param name="FirstRow"/>
                <xsl:param name="LastRow"/>
                <xsl:for-each select="$Rows">
                    <xsl:variable name="KeepItemsTogether" select="false()"/>
                    <xsl:variable name="HideGroupDetail" select="false()"/>
                    <xsl:variable name="GroupStyle" select="'auto'"/>

    <!-- this next line is used to store the value we need to compare for uniqueness -->
                    <xsl:variable name="uniqueTitle" select="@Title"/>

                    <xsl:if test="(position() &gt;= $FirstRow and position() &lt;= $LastRow) or $KeepItemsTogether">
                        <xsl:if test="not($HideGroupDetail)" ddwrt:cf_ignore="1">
    <!-- this next part is where we compare the variable created above to the current selection and if they are different, we write the value -->
            <xsl:if test="@ID=//Rows/Row[@Title=$uniqueTitle][1]/@ID">
                            <option style="display:{$GroupStyle}" value="
    {@Title
    }">
                                <xsl:value-of select="@Title"/>
                            </option>
    </xsl:if>
                        </xsl:if>
                    </xsl:if>
                </xsl:for-each>
            </xsl:template>
    5. Save the page.  Notice that only the unique values are displayed.  You can use this code in any number of places in the XSLT (for example, inside a drop-down menu).

  • Use a drop-down control's onchange event to navigate to pages dyanamically

    I have seen this come up a few times lately and I feel like I'm just typing the same thing over an over, so I'll post it here.  I'm sorry I am being so bad about posting lately, I am going to try to do better.

    The goal of this article is to use an XML data source to populate a drop-down control that will take you to some other URL when you change the drop-down controls value. Now, if you are using List Data, you may want to check out my article for breaking up a URL field type. And I am going to post in just a minute or two with instructions for selecting unique values in the drop-down.

    1. Open your page in FrontPage 2003
    2. Data..Insert Data View
    3. Choose your data source, right click > Show Data
    4. Select the fields you want to use in the drop-down
    5. Insert Data View
    6. Data..Style
    7. Change to “Drop-down view style”..OK
    8. Switch to code view
    9. Just before the </head> tag, add this code:

    <script language="JavaScript">
    <!--
    function FP_jumpMenu(el,frm,sel) {//v1.0
    var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
    if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
    }
    // -->
    </script>

    11. FIND: <select name="ID" size="1"
    12. Change to: <
    select name="ID" size="1" onchange="FP_jumpMenu(this,'window',false)">
    13. 
     FIND: <option style="display:{$GroupStyle}"
    14. Change to: <option style="display:{$GroupStyle}" value=”{@FieldWithURL}”> <!--where FieldWIthURL is your field with the URL J
    -->
    15. 
    Save the page and preview in the browser.

  • Using Conditional Formatting and the data view opens up a whole new world of possibilities

    I have a Data View Web Part that displays the status of several different servers I maintain.  Basically, I am using a SharePoint list.  The List has a Title field which contains the name of each server and a multiple choice field that lets me set the status to "UP," "DOWN," or "CAUTION."

    For each of these three statuses, I have a little gif image of a green arrow, red arrow and yellow circle respectively.  What I want to do is create a data view that has the name of the server and displays the arrow based on the what the status is. 

    Here's how to do that.

    1. Open the wss site in FrontPage 2003
    2. Click Data..Insert Data View
    3. Right click the SharePoint list that contains my data
    4. Click "Show Data"
    5. Select the Title field
    6. Click "Insert Data View"
    7. Since I only selected one field, I get a bulleted list. So I change this: by clicking on Data..Style > General tab and changing to Tabular view..OK
    8. Place the Cursor next to one of the server names and add a new column to my view: Table > Insert > Rows and Columns
    9. Place the Cursor inside a cell in this new column and insert my image
    10. Insert > Picture from file
    11. I type in the URL to the green.gif
    12. Next to this image, I insert the red.gif and yellow.gif as well so each row of data now shows all three images
    13. Select the green.gif image
    14. Click on Data..Conditional Formatting
    15. Click Create
    16. Click Show Content...
    17. I create a filter that says "Status == UP"..OK (now the green arrow only shows in rows where status is UP)
    18. Repeat steps 13 through 17 for the other two gifs, setting the filter appropriately
    19. Save the page

    Using Conditional Formatting opens up a huge world of possibilities.  You can modify views by passing parameters via web part connections, you can format items conditionally, you can show data or hide data based on complex XPATH by clicking on the Advanced button in the filter dialog, and on and on.

  • Customizing List Form web parts should be easy but isn't

    This is one of those issues that bugs me quite a bit.  When you want to customize the NewForm or EditForm.aspx pages on a wss site, you have to live in code (reading CAML or encoded HTML). Or even build something yourself from scratch.

    Since the toolbar for these List Forms can't be customized, it is really challenging to make these form look the way you want.  Here is a tip for creating a new toolbar.  If any of you have better tips or tricks for doing this, let me know!

    Open the NewForm.aspx page for any SharePoint List in FrontPage.

    Right click the List Form Web Part and choose “Customize SharePoint List Form”

     

    WARNING: You are no longer in WYSIWYG land. Do not delete any of the yellow icons or anything you see.

     

    TO PUT IN A NEW SAVE BUTTON AT THE BOTTOM OF THE FORM:

     

    Place the cursor to the Right of the last yellow icon with a question mark in it and type “Save”

    Select this text

    Insert > hyperlink

    ADDRESS: javascript:ClickOnce();

    OK

     

    Save the page and preview it.  Add some data to make sure this works.  If it doesn’t, remember it is case sensitive.

     

     

     

    If you want to remove a single link from the toolbar, you need to remove the whole toolbar and add the links back manually. 

    Right click the List Form Web Part and choose “List Form Properties” then uncheck the box to show the toolbar.


    Then add back the links from the toolbar by hand

     

    Insert a new Table row above the row with the Title field

    Type “Attachment”

    Select “Attachment”

    Insert > hyperlink

    ADDRESS: javascript:UploadAttachment();

    OK

    Let me know what you all think!

    -John

  • Howto: Display list or document library data from a parent site within a different site

    I get asked this one a lot, and thought I had blogged it but it looks like I didn't.  The general user scenario is where you have a parent site (http://myserver) that contains a list of information that is relevant to a bunch of subsites (http://myserver/subsite) and you want to display the data from the parent inside the children.

    For these steps, the server I am using is called: http://myserver, on this server is my subsite: http://myserver/subsite

    1. Open this subsite in FrontPage
      1. Browse to http://myserver/subsite/default.aspx and click File > Edit in Microsoft FrontPage, or
      2. Launch FrontPage and click File > Open Site and type in this URL
    2. Open the default.aspx page if it isn’t open already
    3. Data..Insert Data View (this should launch the Data Source Catalog)
    4. At the bottom of the Catalog, expand “XML Web Services”
    5. Click “Add to catalog”
    6. Type in this URL: http://myserver/_vti_bin/lists.asmx
    7. Click “Connect now”
    8. In the “Operation” drop-down, change the value to “GetListItems” method
    9. Change the listName property to “Announcements” (without the quotes)
    10. Click OK
    11. Right click this data source and choose “Show Data” (should launch the Data View Details taskpane)
    12. Select the fields you want to display
    13. Place the Cursor in the page where you want to insert the Data View
    14. Click “Insert Data View” from the taskpane
    15. From the Data..Style menu, you can control the appearance, paging, toolbars, etc.
    16. From the Data..Filter menu, you can add a filter for the data source
    17. From the Data..Web Part Properties dialog, you can control the web part chrome
    18. By going into code view, you can add the JavaScript to enable the drop-down menu items for editing the list items, if that’s what you want.  You can also use FrontPage’s design tools to create hyperlinks. For example:
      1. Select the title data value
      2. Insert > Hyperlink
      3. Create a hyperlink to the editform.aspx page
      4. Click on Parameters
      5. Add a parameter to the URL for the List ID number
      6. OK back to the page

    That should allow you to click on the Title and edit that specific list item

    All of the functionality is there, it’s just a matter of knowing how to add it.
    I made these steps very long to be careful, but it really is quite easy.

    Let me know if any of this needs further clarification.

    -John

  • use SharePoint's web services to access list data using FrontPage

    Windows SharePoint Services ships with some really powerful web services that allow users to access list and site information not available through other means.  FrontPage 2003 allows users to access these web services in a very straight forward manner, populating all of the query fields dynamically so that little or no knowledge of SOAP is required.

    This example here describes how to use the Data View Web Part to access the lists.asmx web service to display the Attachments on list items in wss.  In order to make this as easy to describe as possible, I will use the Announcements list.

    So, to start, I browse to the announcements list on my server: http://myserver/subsite/lists/announcements/forms/allitems.aspx and add a new announcement.  The title is 'foo' and I click to add an attachment which is called attachment.htm.  By default, I now how two announcements in my list, on with title "Welcome to Windows SharePoint Services..." and one with title "foo."  I open this site in FrontPage 2003 and create a new blank page on which to work.

    1. Data..Insert Data View
    2. In the Data Source Catalog, Right click Announcements > Show Data
    3. In the Data View Details taskpane, select the Title and the Body and click "Insert Data View" (this should create a data view web part on your blank page displaying the Title and Body for the two announcements)
    4. Data..Insert Data View
    5. Expand the "XML Web Services" section of the Catalog
    6. Click "Add to Catalog"
    7. In the "Service Description Location" type: http://myserver/subsite/_vti_bin/lists.asmx
    8. Click "Connect now"
    9. Under "Operation" change to the "GetAttachmentCollection" method
    10. Double click "listName" and set the value to "Announcements"..OK
    11. Double click "listItemID" and set the value to '2' (without the quotes - this is the ID of the item that has the attachment from above, if you set this value to 1, step 14 will not work), check the box that "The value of this parameter can be set at runtime"..OK
    12. Click OK to the Data Source Properties dialog
    13. Right click this new data source in the Data Source Catalog > Show Data
    14. You should see  the path to your attachment load in the Data View Details tree
    15. Place your cursor under the DVWP you inserted in step 3
    16. Select the "Attachment" data value in the DVD tree and click "Insert Data View" (you should now have two data views on your page, one of the titles and body and one of the attachments)
    17. Right click the Data Value to the Attachment and Format Items As > Hyperlink
    18. Right click the first data view > Web Part Connections
    19. Use the Connections wizard to create a connection which will pass the ID value from the first data view to the second
      1. PROVIDE DATA VALUES TO > NEXT
      2. CONNECT TO A WEB PART ON THIS PAGE > NEXT
      3. TARGET WEB PART: Lists on Subsite; TARGET ACTION: Modify web part using Parameters from > NEXT
      4. COLUMNS IN ANNOUNCEMENTS: ID; INPUTS TO LISTS: listItemID >NEXT (if you don't have listItemID, you forgot to check the box in step 11)
      5. CREATE A HYPERLINK ON TITLE and INDICATE CURRENT SELECTION USING: ID > NEXT
      6. FINISH
    20. Save the Page and Preview in the Browser
    21. Click on "Foo" and you will see the Link to its attachment.  Click the link and see the Attachment load in your browser.

    I hope that this introduction to web services in SharePoint and FrontPage inspires you to check out all the other methods.  Let us know what problems you've solved by using these web services!

    Thanks!

  • use SharePoint's web services to access list data using FrontPage

    Windows SharePoint Services ships with some really powerful web services that allow users to access list and site information not available through other means.  FrontPage 2003 allows users to access these web services in a very straight forward manner, populating all of the query fields dynamically so that little or no knowledge of SOAP is required.

    This example here describes how to use the Data View Web Part to access the lists.asmx web service to display the Attachments on list items in wss.  In order to make this as easy to describe as possible, I will use the Announcements list.

    So, to start, I browse to the announcements list on my server: http://myserver/subsite/lists/announcements/forms/allitems.aspx and add a new announcement.  The title is 'foo' and I click to add an attachment which is called attachment.htm.  By default, I now have two announcements in my list, one with title "Welcome to Windows SharePoint Services..." and one with title "foo."  I open this site in FrontPage 2003 and create a new blank page on which to work.

    1. Data..Insert Data View
    2. In the Data Source Catalog, Right click Announcements > Show Data
    3. In the Data View Details taskpane, select the Title and the Body and click "Insert Data View" (this should create a data view web part on your blank page displaying the Title and Body for the two announcements)
    4. Data..Insert Data View
    5. Expand the "XML Web Services" section of the Catalog
    6. Click "Add to Catalog"
    7. In the "Service Description Location" type: http://myserver/subsite/_vti_bin/lists.asmx
    8. Click "Connect now"
    9. Under "Operation" change to the "GetAttachmentCollection" method
    10. Double click "listName" and set the value to "Announcements"..OK
    11. Double click "listItemID" and set the value to '2' (without the quotes - this is the ID of the item that has the attachment from above, if you set this value to 1, step 14 will not work), check the box that "The value of this parameter can be set at runtime"..OK
    12. Click OK to the Data Source Properties dialog
    13. Right click this new data source in the Data Source Catalog > Show Data
    14. You should see the path to your attachment load in the Data View Details tree
    15. Place your cursor under the DVWP you inserted in step 3
    16. Select the "Attachment" data value in the DVD tree and click "Insert Data View" (you should now have two data views on your page, one of the titles and body and one of the attachments)
    17. Right click the Data Value to the Attachment and Format Items As > Hyperlink
    18. Right click the first data view > Web Part Connections
    19. Use the Connections wizard to create a connection which will pass the ID value from the first data view to the second
      1. PROVIDE DATA VALUES TO > NEXT
      2. CONNECT TO A WEB PART ON THIS PAGE > NEXT
      3. TARGET WEB PART: Lists on Subsite; TARGET ACTION: Modify web part using Parameters from > NEXT
      4. COLUMNS IN ANNOUNCEMENTS: ID; INPUTS TO LISTS: listItemID >NEXT (if you don't have listItemID, you forgot to check the box in step 11)
      5. CREATE A HYPERLINK ON TITLE and INDICATE CURRENT SELECTION USING: ID > NEXT
      6. FINISH
    20. Save the Page and Preview in the Browser
    21. Click on "Foo" and you will see the Link to its attachment.  Click the link and see the Attachment load in your browser.

    I hope that this introduction to web services in SharePoint and FrontPage inspires you to check out all the other methods.  Let us know what problems you've solved by using these web services!

    Thanks!

  • Using a form to filter a data view web part - or NOT

    This is a modified post.  My original code sample was more complicated than it needed to be.  This one is WAY simpler.

    I was just thinking that it should be a lot easier to use a Form Web Part and be able to either filter a data view based on that Form's contents, or to pass in an “ALL” value.  Basically, when you enable the Filtering toolbar for the Data View, this is what you get, but in my scenario, I wanted to be able to go cross-page with my filter.

    My wife had a baby 2 weeks ago, so I've been OOF for a bit, but this morning I sat down and decided I needed to enable this for my baby's blog...

    Here it is.  For this example, I just use the Announcements list default views because wss sites usually get this list by default.

    1. On a new page insert a few of the Announcements list
    2. Insert a Form Web Part
    3. Change the input type of the Form to be a drop-down field and add some values:
      1. All
      2. 1
      3. 2
    4. Place the cursor into the Data View you created in Step 1 and click on Table..Select > Row
    5. Click on Data..Conditional Formatting
    6. Click on Create
    7. Click on “Show content...“
    8. Field Name == ID
    9. Comparison == Equals
    10. Value == [Input Paramter]
    11. Click OK
    12. Right click the Form Web Part > Web Part Connections
    13. Provide Data Values to...
    14. Web Part on this page...
    15. Modify view using Parameters from...
    16. D1 == Input Parameter
    17. Finish the wizard
    18. Now switch to code view
    19. Add an OR so that we test for the FilterParameter saying 'All'.

    currently, the dvt_1.body template looks like this:

             <xsl:template name="dvt_1.body">
                 <xsl:param name="Rows"/>
                 <xsl:param name="FirstRow"/>
                 <xsl:param name="LastRow"/>
                 <xsl:for-each select="$Rows">
                     <xsl:variable name="KeepItemsTogether" select="false()"/>
                     <xsl:variable name="HideGroupDetail" select="false()"/>
                     <xsl:variable name="GroupStyle" select="'auto'"/>
                     <xsl:if test="(position() &gt;= $FirstRow and position() &lt;= $LastRow) or $KeepItemsTogether">
                         <xsl:if test="not($HideGroupDetail)" ddwrt:cf_ignore="1">
                             <xsl:if test="@ID = $filterParam">
                                 <tr style="display:{$GroupStyle}">
                                     <td class="ms-vb"><xsl:value-of select="@Title"/></td>
                                     <td class="ms-vb"><xsl:value-of select="@Editor"/></td>
                                     <td class="ms-vb"><xsl:value-of select="ddwrt:FormatDate(string(@Modified), 1033, 5)"/></td>
                                 </tr>
                             </xsl:if>
                         </xsl:if>
                     </xsl:if>
                 </xsl:for-each>
             </xsl:template>

    You need to add the code in bright red:

             <xsl:template name="dvt_1.body">
                 <xsl:param name="Rows"/>
                 <xsl:param name="FirstRow"/>
                 <xsl:param name="LastRow"/>
                 <xsl:for-each select="$Rows">
                     <xsl:variable name="KeepItemsTogether" select="false()"/>
                     <xsl:variable name="HideGroupDetail" select="false()"/>
                     <xsl:variable name="GroupStyle" select="'auto'"/>
                     <xsl:if test="(position() &gt;= $FirstRow and position() &lt;= $LastRow) or $KeepItemsTogether">
                         <xsl:if test="not($HideGroupDetail)" ddwrt:cf_ignore="1">
                             <xsl:if test="@ID = $filterParam or $filterParam = 'All'">
                                 <tr style="display:{$GroupStyle}">
                                     <td class="ms-vb"><xsl:value-of select="@Title"/></td>
                                     <td class="ms-vb"><xsl:value-of select="@Editor"/></td>
                                     <td class="ms-vb"><xsl:value-of select="ddwrt:FormatDate(string(@Modified), 1033, 5)"/></td>
                                 </tr>
                             </xsl:if>
                         </xsl:if>
                     </xsl:if>
                 </xsl:for-each>
             </xsl:template>

    20. Save the page and check it out in the browser.

    Good luck!
    -John

  • HOWTO: Fire a connection from the Drop-down view style of the Data View Web Part

    Hey there.  FrontPage shipped a View Style for the Data View Web Part that doesn't really do anything.  The style is the drop-down style.  What most people want from this style is the ability to fire connections from it, so I wrote a KB article about this.  That is still in draft state, but I've seen this question so many times, I felt I had to post it here as well.

    Good luck!

     

    1. Insert two Data Views of your data.

    2. Select one of the Data Views, choose Style from the Data View Details taskpane.

    3. Choose the drop-down box style from the list of styles, click OK.

    4. Right click this Data View, choose Web Part connections.

    5. Connect to the other Data View as you would normally.

    6. Go into Code View.

    7. Look for the <a target="_self"> code that looks similar to this (usually, it would be the first <a> tag in the page) and copy the entire block for the first XSL:ATTRIBUTE (see below):

    <a target="_self">

    <!-- NOTE: start copying here -->
    <xsl:attribute xmlns:xsl="
    http://www.w3.org/1999/XSL/Transform" name="href"><xsl:variable name="cursel">dvt_curselkey={<xsl:value-of select="$CurrentRowKey"/>}</xsl:variable><xsl:variable xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="fields">@ID=<xsl:value-of select="ddwrt:ConnEncode(string(@ID))"/></xsl:variable>javascript:<xsl:value-of select="ddwrt:GenFireConnection(concat('99d2bb39-f973-482c-a0ca-e49b56eae72d*',$fields),string($cursel))"></xsl:value-of></xsl:attribute>
    <!-- NOTE: end copying here-->

    <xsl:attribute name="style"><xsl:if test="$CurrentRowKey = $dvt_curselkey">font-weight: bold;</xsl:if></xsl:attribute>
    <xsl:value-of select="@Title"/>
    </a>

    8. Look for the code for the <option> tag.  It should be right above the <a> tag.

    9. Paste in the section of code you copied above. 

    10. Change the name="href" part to name="value".  At this point, you should have something like this:

    <option style="display:{$GroupStyle}">
      <xsl:attribute xmlns:xsl="
    http://www.w3.org/1999/XSL/Transform" name="value"><xsl:variable name="cursel">dvt_curselkey={<xsl:value-of select="$CurrentRowKey"/>}</xsl:variable><xsl:variable xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="fields">@ID=<xsl:value-of select="ddwrt:ConnEncode(string(@ID))"/></xsl:variable>javascript:<xsl:value-of select="ddwrt:GenFireConnection(concat('99d2bb39-f973-482c-a0ca-e49b56eae72d*',$fields),string($cursel))"></xsl:value-of></xsl:attribute>
      <a target="_self">
        <xsl:attribute xmlns:xsl="
    http://www.w3.org/1999/XSL/Transform" name="href"><xsl:variable name="cursel">dvt_curselkey={<xsl:value-of select="$CurrentRowKey"/>}</xsl:variable><xsl:variable xmlns:xsl="http://www.w3.org/1999/XSL/Transform" name="fields">@ID=<xsl:value-of select="ddwrt:ConnEncode(string(@ID))"/></xsl:variable>javascript:<xsl:value-of select="ddwrt:GenFireConnection(concat('99d2bb39-f973-482c-a0ca-e49b56eae72d*',$fields),string($cursel))"></xsl:value-of></xsl:attribute>
        <xsl:attribute name="style"><xsl:if test="$CurrentRowKey = $dvt_curselkey">font-weight: bold;</xsl:if></xsl:attribute>
        <xsl:value-of select="@Title"/>
      </a>
    </option>

    11. Look for the <select> tag for the drop down.  It should look something like:

    <select name="ID" size="1">

    12. Add an onchange event handler for the tag, as follows:

    <select name="ID" size="1" onchange="eval(this.options.value)">


    Now when you change the value your drop-down, your connection should fire.

More Posts Next page »

© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker