Thursday 13 June 2013

Parent-child data filter using query string id

Firstway:(will work only for by default list dispform.doesnt work to the custom dispform.aspx)

Create two lists one is parent and another one is child .child list contains a lookup as parent list

 list advanced settings -->set modal popup to-->No(last option)
after that goto parent list -->click on any item dispform-->Edit page-->Click on list below-->insert Related list

After that data directly filter based on parent item

Secondwayway:(will work custom dispform and by default list form)

Create two lists one is parent and another one is child .child list contains a lookup as parent list

Given lookup parent title with id in childlist

 list advanced settings -->set modal popup to-->No(last option)

after that goto parent list -->click on any item dispform-->Edit page-->Addwebpart-->list and libraries-->select child list

here the child list will come above parent in dispform .if u want below then goto Sharepoint designer -->parentlist dispform-->design-->cut the child list content-->paste below the parent (both the parent and child will be in single table and single div)-->save

Goto parent dispform in desigener and follow the below steps
In side of "xsltListviewwebpart, on your page add below lines....

Add below line in <ParameterBindings>

<ParameterBinding Name="Param1" Location="QueryString(ID)" DefaultValue="" />

After that add below line in "<Query>"
<Where>
      <Eq>
       <FieldRef Name="Workstream_x003a_ID"/>
       <Value Type="Text">{Param1}</Value>
      </Eq>
     </Where>


Workstream_x003a_ID---->Child llokup parent ID field in child list. child list thename isWorkstream_x003a_ID
Param1:query string id in the url










No comments:

Post a Comment