Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
    
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

3 Answers 3

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.

share|improve this answer

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.

share|improve this answer
    
Sorry, doesn't make a lot of sense to me –  Flo Feb 23 '12 at 9:02

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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