Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdatePanel, JavaScript postback and changing querystring at same time in SharePoint Search Page
    primarykey
    data
    text
    <p>Been tearing my hear out with this one. Let me see if I can explain:</p> <p>I have a SharePoint results page on which I have a Search Results Core WebPart. Now I want to change the parameter in the querystring when I postback the page so that the WebPart returns different results for each parameter e.g. the querystring will be interactivemap.aspx?k=Country:Romania this will filter the results for Romania.</p> <p>First issue is I want to do this with javascript so I call:</p> <pre><code>document.getElementById('aspnetForm').action = "interactivemap.aspx?k=Country:" + country; </code></pre> <p>Nothing special here but the reason I need to call from Javascript is there is also a flash applet on this page from which the Javascript calls originate. When the javascript calls are made the page needs to PostBack but not reload the flash applet. </p> <p>I turned to ASP.Net AJAX for this so I wrapped the search results webpart in an update panel. Now if I use a button within the UpdatePanel to postback the UpdatePanel behaves as expected and does a partial render of the search results webpart not reloading the flash applet. </p> <p>Problem comes because I need postback the page from javscript. I called __doPostBack() as I have used this successully in the past. It works on it's own but fails when I first call the above Javascript before the __doPostBack() (I also tried calling click() on a hidden button) the code for the page is at the bottom.</p> <p>I think the problem comes with the scriptmanager not allowing a partial render when the form post action has changed.</p> <p>My questions are.</p> <p>A) Is there some other way to change the search results webpart parameter without using the querystring.</p> <p>or</p> <p>B) Is there a way around changing the querystring when doing an AJAX postback and getting a partial render.</p> <pre><code> &lt;asp:content contentplaceholderid="PlaceHolderFullContent" runat="server"&gt; &lt;asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" /&gt; &lt;SPSWC:pagelevelerror runat="server" id="PageLevelError"/&gt; &lt;script type="text/javascript"&gt; function update(country) { //__doPostBack('ContentUpdatePanel', ''); //document.getElementById('aspnetForm').action = "interactivemap.aspx?k=ArticleCountry:" + country; document.getElementById('ctl00_PlaceHolderFullContent_UpdateButton').click(); } &lt;/script&gt; &lt;div id="flashFeature"&gt; &lt;object type="application/x-shockwave-flash" data="_layouts/HFT/flashApplets/interactiveMap/interactiveMap/interactiveMapAssets/IMap.swf" width="100%" height="500px" id="flashContent" style="visibility: visible;"&gt; &lt;param name="bgcolor" value="#cccccc"&gt;&lt;param name="allowfullscreen" value="true"&gt; &lt;param name="allowscriptaccess" value="always"&gt; &lt;param name="flashvars" value="ASSETS_FOLDER=_layouts/HFT/flashApplets/interactiveMap/interactiveMap/interactiveMapAssets/"&gt; &lt;param name="movie" value="_layouts/HFT/flashApplets/interactiveMap/interactiveMap/interactiveMapAssets/IMap.swf"&gt; &lt;embed src="_layouts/HFT/flashApplets/interactiveMap/interactiveMap/interactiveMapAssets/IMap.swf" width="100%" height="500px"&gt;&lt;/embed&gt;&lt;/object&gt; &lt;/div&gt; &lt;div onclick="update('Romania');"&gt;Romania&lt;/div&gt; &lt;div class="firstDataTitle"&gt; &lt;div class="datatabletitleOuterWrapper"&gt; &lt;div class="datatabletitle"&gt; &lt;span&gt;Content&lt;/span&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="datatableWrapper"&gt; &lt;div class="dataHolderWrapper"&gt; &lt;div class="datatable"&gt; &lt;div&gt; &lt;div class="searchMain"&gt; &lt;div class="searchZoneMain"&gt; &lt;asp:UpdatePanel runat="server" id="ContentUpdatePanel" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;WebPartPages:webpartzone runat="server" AllowPersonalization="false" title=" &lt;%$Resources:sps,LayoutPageZone_BottomZone%&gt;" id="BottomZone" orientation="Vertical" QuickAdd-GroupNames="Search" QuickAdd-ShowListsAndLibraries="false"&gt;&lt;ZoneTemplate&gt; &lt;/ZoneTemplate&gt;&lt;/WebPartPages:webpartzone&gt; &lt;asp:Button id="UpdateButton" name="UpdateButton" runat="server" Text="Update"/&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/asp:content&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload