I'm stuck with the following Problem:

The Task:

I do have a custom SharePoint form which displays an entry from one of my SharePoint lists. On that Form I am using a ListViewWebPart to show the content of a specific Folder from a SharePoint document library.

The query part of that ListViewWebPart looks like this:

    <FieldRef Name="FileDirRef"/>
      <Value Type="Text">{MyParameter}</Value>

Now if I replace {MyParameter} with let's say "Documents/Billing/001" it shows exactly what I want it to show: The content of that folder.

How can I use

The Problem: How can I grab a property of the actual viewed list item (let's say "MyCustomID") and pass it as a parameter to MyParameter in the query of that ListViewWebPart?


I am using a simple HTML table containing entries to display the list item and as described above a ListViewWebPart to display the Document Library

Any ideas would be much appreciated.

  • Are both webparts (the list and the details form) on the same page? If so, you can use webpart connections instead of a parameter – Louis Feb 22 '12 at 11:51
  • Yes they are both on the same page. But I am displaying the List Item using a HTML Table and then placing <SharePoint:ListItemProperty. Any way to connect them? – Flo Feb 22 '12 at 11:57
  • So the page is always displaying the same ListItem? – Louis Feb 22 '12 at 12:17
  • No, it shows a selected list item entry. – Flo Feb 23 '12 at 9:02

you can find the ListViewWebPart by code and set the HtmlSchemaView property by reflect.

here is a open-source project : http://camlquery.codeplex.com/ you can find how to set the query condition of ListViewWebPart dynamically.


Would it work if you had a dropdown in your page, where users would select the entry to display? You can bind MyParameter to any ASP control on the page, so your view would be filtered by the dropdown's selection.

You can also populate the dropdown with values from a list item (by binding it to a SPDataSource). Unfortunately a dropdown only has one column to show values.

If this looks like a promising path I will update this post with more info on how to do it.

  • sorry, dropdown is not the way we want to go. there must not be any user interaction to show the content of the right folder. – Flo Feb 22 '12 at 12:24

I can't make it work but maybe you can use ListItemProperty control like this:

                         <FieldRef Name="aaa"/>
                         <Value Type='Text'>
                             <ListItemProperty List="{47F75936-D9D1-4B86-900F-F0B111073950}" ListItemID="1" Property="MyCustomID" runat="server">

At least such a construction doesn't break anything.

  • Sorry, doesn't make a lot of sense to me – Flo Feb 23 '12 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.