My site is written in C# with ASP.NET, all pages being loaded are .aspx pages.
I'm using a button
<input type="button" onclick="FindBuilding()">
to trigger a javascript function
function FindBuilding() {
$('#BuildingPopup).load('./BuildingPopup.aspx?lid=xxx');
$('#BuildingPopup).dialog('open');
}
that opens a modal dialog I've created
$("#BuildingPopup").dialog({
modal: false,
autoOpen: false,
position: "center",
resizable: false,
height: 671,
width: 1042,
stack: true
});
The dialog is created inside $(document).ready
function
The Problem:
After the dialog loads BuildingPopup.aspx the parent page then loads the same page -- this happens anytime I try to load any page in a modal dialog, regardless of content. BuildingPopup.aspx is just an example.
What I have tried to fix it:
I have tried creating the dialog first, then loading the page using the open
button. I have also tried using an iframe
which works but the pages never display well and it's a hassle/bad fix.
Some clues?
- Some of the pages are calling a web service through AJAX during page load
- The problem persists on pages with and without updatepanels
- Some pages are evaluating code blocks during page load
UPDATE
I have discovered that the problem occurs when an updatepanel on the parent page updates.
<asp:UpdatePanel ID="updatepanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
This occurs when an <asp:Timer>
executes an OnTick() method in the codebehind(to update the panel).