locked
How to append the querystring value of connected webpart to URL RRS feed

  • Question

  • Hi,

    I have used following javascript code to filter the SharePoint List which was resulting few records in the result set.

    <script type="text/javascript">
     function RedirectUrl() {
     var tb = document.getElementById("tbSearch").value;
     var cs = document.getElementById("sfield").value;
     var url = "";

     if (tb != "") {
      if (cs == "MS%5Fx0020%5FTechnology%5Fx0020%5FExperi" || cs == "Total%5Fx0020%5F%5Fx0023%5F%5Fx0020%5Fof%5Fx00" || cs == "Ajax" || cs == "ASP" || cs == "ASP%5Fx002e%5FNET" || cs == "BizTalk%5Fx0020%5FServer" || cs == "C%5Fx0023%5F" || cs == "C%5Fx002b%5F%5Fx002b%5F" || cs == "Dynamics%5Fx0020%5FCRM" || cs == "Design%5Fx0020%5FPatterns" || cs == "Date%5Fx0020%5Fof%5Fx0020%5FJoining%5Fx002" || cs == "IIS%5Fx0020%5FAdministration" || cs == "MS%5Fx002d%5FAccess" || cs == "MOSS%5Fx002f%5FSharePoint" || cs == "SilverLight" || cs == "SQL%5Fx0020%5FServer" || cs == "SSAS" || cs == "SSIS" || cs == "SSRS" || cs == "VB" || cs == "VB%5Fx002e%5FNET" || cs == "WCF" || cs == "Winforms" || cs == "WPF" || cs == "WWF" || cs == "XAML"){
      url = "FilterField1=" + cs + "&FilterValue1=" + tb;
      window.location.href = "Update%20Skill%20Matrix.aspx?" + url;
      }
      else { 
      url = "FilterName=" + cs + "&FilterMultiValue=*" + tb + "*";
      window.location.href = "Update%20Skill%20Matrix.aspx?" + url;
      }
      }
      else {
      return false;
      }
     }
     function ClearUrl() {
     window.location.href = "Update%20Skill%20Matrix.aspx";
     }
    </script>
    Search Field: <select id="sfield">
    <option selected value="Title" >MS CoE Associate Name</option>
    <option value="MS%5Fx0020%5FTechnology%5Fx0020%5FExperi">MS Technology Exp</option>
    <option value="Total%5Fx0020%5F%5Fx0023%5F%5Fx0020%5Fof%5Fx00">Total IT Experience</option>
    <option value="Ajax">Ajax</option>
    <option value="ASP">ASP</option>
    <option value="ASP%5Fx002e%5FNET">ASP.NET</option>
    <option value="BizTalk%5Fx0020%5FServer">Biztalk Server</option>
    <option value="C%5Fx0023%5F">C#</option>
    <option value="C%5Fx002b%5F%5Fx002b%5F">C++</option>
    <option value="Dynamics%5Fx0020%5FCRM">MS Dynamics CRM</option>
    <option value="Design%5Fx0020%5FPatterns">Design Patterns</option>
    <option value="Date%5Fx0020%5Fof%5Fx0020%5FJoining%5Fx002">DOJ</option>
    <option value="IIS%5Fx0020%5FAdministration">IIS</option>
    <option value="MS%5Fx002d%5FAccess">MS Access</option>
    <option value="MOSS%5Fx002f%5FSharePoint">MOSS Or SharePoint</option>
    <option value="SilverLight">SilverLight</option>
    <option value="SQL%5Fx0020%5FServer">SQL Server</option>
    <option value="SSAS">SSAS</option>
    <option value="SSIS">SSIS</option>
    <option value="SSRS">SSRS</option>
    <option value="VB">VB</option>
    <option value="VB%5Fx002e%5FNET">VB.NET</option>
    <option value="WCF">WCF</option>
    <option value="Winforms">Winforms</option>
    <option value="WPF">WPF</option>
    <option value="WWF">WWF</option>
    <option value="XAML">XAML</option>
    </select>
    &nbsp;
    Search text: <input type="text" id="tbSearch" />
    <input type="button" id="btnSearch" value="Search" onclick="return RedirectUrl();" />
    <input type="button" id="btnClear" value="Clear" onclick="return ClearUrl();" />


    The URL is changed to "//Update%20Skill%20Matrix.aspx?FilterName=Title&FilterMultiValue=*janaiah*" .
    As this list is connected source webpart, I have clicked on one of items to filter the items in another webpart. The other webpart values are filtering as expected but the URL is being changed to "/Update%20Skill%20Matrix.aspx?View={724326D2-930E-46A1-BEB1-1211CEBFFA8A}&SelectedID=90" instead of appending these 2 query string values to existing URL. Due to refreshing the URL, first connected source webpart is loading with all the bunch of records instead of displaying filterd values in it.

    Please suggest me / guide me to overcome this problem.


    Thanks In Advance.

    Regards
    Johny

    • Moved by Mike Walsh FIN Tuesday, January 18, 2011 9:49 AM admin or programming. Not general (From:SharePoint - General Question and Answers and Discussion (pre-SharePoint 2010))
    Tuesday, January 18, 2011 5:30 AM

Answers

  • Hi,

    I found the solution is as follows:

    From the above script, when ever we search an item, the url would be changed to "/../asdf.aspx?FilterName=Title&FilterMultiValue=*janaiah*" . Instead of this url, slightly rewrite the url as ""/../asdf.aspx?View=[WebPartID]&FilterName=Title&FilterMultiValue=*janaiah*" .

    Note: WebPartID is a GUID id, we can copy this id by opening .aspx page in designer.

    Now try to select a radiobutton from the connected source webpart, the newly filtered url would be remain same apart from "SelectField" querystring value.

     

    Thanks,

    Johny

    • Marked as answer by Johny Yadav Friday, January 21, 2011 10:58 AM
    Friday, January 21, 2011 10:57 AM