2

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:

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

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?

UPDATE

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.

4
  • Are both webparts (the list and the details form) on the same page? If so, you can use webpart connections instead of a parameter Commented Feb 22, 2012 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? Commented Feb 22, 2012 at 11:57
  • So the page is always displaying the same ListItem? Commented Feb 22, 2012 at 12:17
  • No, it shows a selected list item entry. Commented Feb 23, 2012 at 9:02

3 Answers 3

1

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.

0

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.

1
  • 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. Commented Feb 22, 2012 at 12:24
0

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

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

At least such a construction doesn't break anything.

1
  • Sorry, doesn't make a lot of sense to me Commented Feb 23, 2012 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.