1

Let's say we have a SP list : "Parents" and a SP list "Children". The later have a lookup field to the former.

In the dispform of the parent, I want to have :

  • the detail of the parent (OOB)
  • the list of children related to the current parent
  • a form to create a new child related to the current parent.

Of course, the lookup mechanisms must completely wrapped in the page.

How can I achieve that ? (preferably using SPD)

The only way I found is to create a custom webpart for the children and putting it in the parent dispform. This is quite a mess as I have to maintain the code beside the children list structure.

2 Answers 2

2

You can do this by adding a Data View Web Part (DVWP) to the page in SharePoint Designer. In your DVWP you'd use an AggregateDataSource containing both the parent and child lists. The DVWP can grab the item ID from the Query String and use it as a filter value.

It sounds like what I'm proposing is what you're already doing, perhaps, but this should at least serve as validation for the approach.

EDIT (based on question below):

I don't have an exact link for this method. However, I have a demo you could look at. Go here http://www.sympraxisconsulting.com/Demos/default.aspx and grab the "Middle Tier - SharePoint Fest Denver 2011" solution. Set it up in your environment and look at EditFormCustom for the Navigation SubAreas list.

5
  • do you have any link ? When I talked about the custom webpart, I mean a coded in VS web part... I'm quite new to SPD. thx
    – Steve B
    May 27, 2011 at 15:33
  • Sorry for the late response. I took a look at your sample. However, it only answer partially to the question (showing child items). I succeeded already to show child data using a simple filtering connection between webpart. What I still don't know how to do (at least without writing code), is to add in the dispform.aspx of "parent", a form for the "child". In you sample, when you want to add a new "navigation items", you still have to select the sub area. The form does not know you are in a sub area
    – Steve B
    Jun 1, 2011 at 12:37
  • I'm not sure I understand where you're trying to go with this. Jun 3, 2011 at 3:20
  • my display form must contains (no popup): 1. the detail of parent 2. the list of children related to the displayed parent and 3. a form to create a new child, without having to select the parent (the current parent must be the parent)
    – Steve B
    Jun 3, 2011 at 7:54
  • Ah. If you have a column in the child form which contains the parent ID, you can hide that column and populate it with script based on the ID on the Query String. Jun 3, 2011 at 18:48
1

I finally found the solution (helped by Marc and this blog post).

Steps to success :

  1. Open in SPD the OOB dispform.aspx of the parent list
  2. In the same page, add a standard XsltViewWebPart or a DataFormWebPart. Use WebPart connexions to filter the data (Consume a filter from the OOB listformwebpart)
    • This may also work with filtering data from the url instead of a WP connection, but I did not tried.
  3. for the last part (inserting a child from the parent form), insert a standard DataFormWebPart (of kind newform to the children list).
  4. add to the DFWP a parameter "ParentID" that takes the ID from the querystring
  5. within the dvt_1.rowinsert xslt template, a textbox like this :

            <tr style="display:none">
                <td>
                    <asp:TextBox text="{$ParentID}" runat="server" id="ff5{$Pos}" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Parent.')}" />
    
                </td>
            </tr>
    

The important part is text="{$ParentID}" which populates the TextBox with the value of the parameter.

1
  • The only lack of this method is that the attachments are not working
    – Steve B
    Jun 6, 2011 at 12:29

Your Answer

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

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