Struggling with a tricky issue here. Let me try to clarify:
I have a SharePoint results page where I'm using a Search Results Core WebPart. Now, I want to modify the parameter in the querystring upon postback so that the WebPart displays different results based on the parameter. For example, the querystring could look like interactivemap.aspx?k=Country:Romania which would filter the results for Romania.
The initial challenge is that I need to achieve this using JavaScript. So, I make the call:
document.getElementById('aspnetForm').action = "interactivemap.aspx?k=Country:" + country;
This may seem straightforward, but the reason for incorporating JavaScript is because there's a flash applet present on the page, and the JavaScript calls stem from it. It's crucial that when these JavaScript calls occur, the page undergoes a PostBack without reloading the flash applet.
To tackle this, I turned to ASP.Net AJAX and encapsulated the search results webpart within an update panel. If I utilize a button within the UpdatePanel to trigger the PostBack, the UpdatePanel functions as intended, rendering only a portion of the search results webpart without refreshing the flash applet.
The problem arises when I attempt to perform a postback from JavaScript. I utilized __doPostBack() as I've done successfully previously. It functions independently, but fails when preceding it with the aforementioned JavaScript (I also tested triggering click() on a hidden button). The code snippet is provided below.
I suspect the issue lies with the scriptmanager not facilitating partial rendering when the form post action has been altered.
My queries are as follows:
A) Is there an alternative method to adjust the search results webpart parameter that doesn't involve employing the querystring?
or
B) Can any workaround be implemented to change the querystring during an AJAX postback while achieving partial rendering?
<asp:content contentplaceholderid="PlaceHolderFullContent" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<SPSWC:pagelevelerror runat="server" id="PageLevelError"/>
<script type="text/javascript">
function update(country) {
//__doPostBack('ContentUpdatePanel', '');
//document.getElementById('aspnetForm').action = "interactivemap.aspx?k=ArticleCountry:" + country;
document.getElementById('ctl00_PlaceHolderFullContent_UpdateButton').click();
}
</script>
<div id="flashFeature">
<object type="application/x-shockwave-flash" data="_layouts/HFT/flashApplets/interactiveMap/interactiveMap/interactiveMapAssets/IMap.swf" width="100%" height="500px" id="flashContent" style="visibility: visible;">
<param name="bgcolor" value="#cccccc"><param name="allowfullscreen" value="true">
<param name="allowscriptaccess" value="always">
<param name="flashvars" value="ASSETS_FOLDER=_layouts/HFT/flashApplets/interactiveMap/interactiveMap/interactiveMapAssets/">
<param name="movie" value="_layouts/HFT/flashApplets/interactiveMap/interactiveMap/interactiveMapAssets/IMap.swf">
<embed src="_layouts/HFT/flashApplets/interactiveMap/interactiveMap/interactiveMapAssets/IMap.swf" width="100%" height="500px"></embed></object>
</div>
<div onclick="update('Romania');">Romania</div>
<div class="firstDataTitle">
<div class="datatabletitleOuterWrapper">
<div class="datatabletitle">
<span>Content</span></div>
</div>
<div class="datatableWrapper">
<div class="dataHolderWrapper">
<div class="datatable">
<div>
<div class="searchMain">
<div class="searchZoneMain">
<asp:UpdatePanel runat="server" id="ContentUpdatePanel" UpdateMode="Conditional">
<ContentTemplate>
<WebPartPages:webpartzone runat="server" AllowPersonalization="false" title=" <%$Resources:sps,LayoutPageZone_BottomZone%>" id="BottomZone" orientation="Vertical" QuickAdd-GroupNames="Search" QuickAdd-ShowListsAndLibraries="false"><ZoneTemplate> </ZoneTemplate></WebPartPages:webpartzone>
<asp:Button id="UpdateButton" name="UpdateButton" runat="server" Text="Update"/>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</asp:content>