Question

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.

Was it helpful?

Solution 2

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top