I have an ASP.NET/C#/Javascript application that has a Master Page and numerous Child Pages. On one of the Child Pages, I have a Google Map that gets it data from the backend like this in the javascript code:
<script type="text/javascript">
async function InitializeMap() {
markersList = await JSON.parse('<%=ConvertDataTabletoString() %>');
...
};
<asp:Panel ID="pnGoogleMap" runat="server">
<div id="divGoogleMap" name="divGoogleMap" style="height: 600px; width: 100%; border: solid; border-color: white; border-width: 10px;" ></div>
</asp:Panel>
<asp:UpdatePanel ID="upCustomerInfo" ChildrenAsTriggers="false" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%-- Desktop version for spacing under map --%>
<asp:Panel ID="pnCustomerInfo" runat="server" style="display:none; border: solid; border-color: #00b2ee; border-width: 10px;" >
<div style="height: 10px"></div>
<button id="btnSaveCustomerInfo" type="button" title="Save" runat="server" onclick="return saveMapView();" class="button-green"><i class="material-icons">save</i></button>
<button id="btnSaveCustomerInfoHelper" type="button" title="Save" runat="server" style="display:none;" onserverclick="btnSaveCustomerInfo_Click" />
...
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSaveCustomerInfo" runat="server" />
<asp:AsyncPostBackTrigger ControlID="btnSaveCustomerInfoHelper" runat="server" />
</Triggers>
</asp:UpdatePanel>
The Google Map is in it's own (non Update Panel) Panel and below it is an Update Panel that is populated with customer information when the user clicks on a pin on the map. When the user clicks the save button in the Update Panel to save customer changes, the "ConvertDataTableToString" method in the backend gets hit again even though it's not inside the Update Panel. I am not wanting to reload/render the map on the Partial Page update when saving customer information.
Though testing I was able to verify that the InitializeMap that contains the call to "ConvertDataTableToString" is NOT being executed on the Partial Page update, just the method itself is called.
I've not been able to figure out why that method is being called and how to prevent it from being called.