locked
Get dropdown list filter webpart value RRS feed

  • Question

  • Hello All,

    I had a list called 'ProjectDetails'. this list contains 3 contenttype to insert data with three different views and custom dropdown filter webpart. list contains a Lookup(ProName) column which can added in all three view, this dropdown is used to filter a list . I created a  custom webpart page and add custom dropdown filter webpart and 'ProjectDetails' list, with different view on the same page.  filtering working fine, data rendering on filter(dropdown selection) was correct. upto here everything is working fine.

    when user click on the 'add new item' of the list, default popup opens and the relavent contenttype form to insert data into the list.

    how can i get the value of the selected dropdown filetered webpart, when user click 'add new item' in any contenttype form, selected values from the dropdown filtered webpart can added to  Lookup(ProName) column without selecting the dropdownlist once again.

    using Javascript + sharepoint designer. or any other approaches to achive this..

    Advance Thnks..


    NS

    Tuesday, November 20, 2012 11:42 AM

Answers

  • Hi NS,

    We can pass the filter from query string to the lookup field in the new form.

    1. In the web part, add 3 list view web parts and filter web part.
    2. Create a parameter for each of the list view. Let’s name it Param1.
    3. Pass filter from filter web part to 3 list view web parts as parameter. In Web part connections wizard, select Param1 from list to match the filter in filter web part. In this way, we can get the filter in list view from Param1.
    4. Add a new row below all list data but above the paging button. Add a hyperlink in code view.
      <a href="http://server/site/Lists/yourlistname/NewForm.aspx?filter={$Param1}">Add new item</a>
    5. Set filters for list view web part by clicking  Filter button on the ribbon > set your column used to filter current list view = Param1
    6. Repeat the step for each list view web part.

    We can already pass the filter as query string in the URL using the hyperlink we created in step4. Next step is to get the filter from query string and fill it to the lookup control.
    http://geekswithblogs.net/SoYouKnow/archive/2009/10/29/setting-sharepoint-form-fields-using-query-string-variables-without-using.aspx

    Thanks & Regards,
    Emir


    Emir Liu

    TechNet Community Support

    • Marked as answer by Emir Liu Thursday, November 29, 2012 4:26 AM
    Wednesday, November 21, 2012 10:53 AM