Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 410
  • Last Modified:

Extract current URL for use in conditional formatting of DVWP values

Hello,

I have a DVWP which lists the web part pages of a library. The metadata for these pages allows for a four-tier hierarchy, and I've built the DVWP to show the respective groupings etc.

This part works fine. I can collapse and expand groups and drill down to the level I need, then click the entry I want and the desired page is displayed.

All these web part pages have the same DVWP as a navigation panel.

I would like to use conditional formatting to highlight the current page link in the DVWP. For example:

I have three pages, green.aspx, red.aspx, blue.aspx. They all have a DVWP listing the three pages

green.aspx
red.aspx
blue.aspx

When I open blue.aspx, I'd like conditional formatting to highlight the entry "blue.aspx" in the DVWP.

I can set up conditional formatting for all kinds of comparisons among the DVWP values. But how can I determine the URL of the current page, so I can compare it to the respective field of the DVWP?  

I'm using SP 2010 Enterprise and SPD 2010. I am not interested in a solution that involves Visual Studio, C# or any tools outside of the SP 2010 GUI or SPD.

The ultimate goal is to create a multi-tiered navigation pane that goes down to a document level and includes only a specific library. If anyone has a better approach, I'm all ears.

cheers, teylyn
0
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Asked:
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
1 Solution
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelAuthor Commented:
Found the solution myself:

I created a parameter for the DVWP and used a server variable that holds the URL.

Here are the steps:

To create a parameter for conditional formatting of the link that is the same as the current page:
- click in the DVWP in Design window
- on the Options ribbon, click "Parameters" > New Parameter
- name the new parameter, for example "srvVar_URL"
- in "Parameter Source" select "Server Variable"
- in Server Variable Name enter "URL" (without the quotes)

To create the conditional formatting
- click in the DVWP in Design window
- Options Ribbon > Conditional Formatting > Format Row
- from the Field Name dropdown, select "URL Path"
- from the Value dropdown, select "[srvVar_URL]" (or the parameter name defined above)
- click "Set Style" and define the style.

cheers, teylyn
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now