thespiceman
asked on
Problem with RegisterStartupScript and showModalDialog
I have an apsx page, Overview.aspx, that uses a call to RegisterStartupScript to register a script that opens a ModalDialog window, memRepHelp.aspx, using window.showModalDialog. It works fine the first time it is called.
Problem: The second time Overview.aspx opens the ModalDialog memRepHelp.aspx the code-behind for memRepHelp.aspx is not executed. memRepHelp.aspx displays showing the old data from the first time it was displayed.
Here's the code from Overview.aspx:
If Not Page.IsPostBack Then
'popup Rep Help window
Dim sCommand As String = "<script language=javascript>window .showModal Dialog ('/member/memRepHelp.aspx' , '','dialogHeight:500px;dia logWidth:3 85px;scrol lbars:no;h elp:no');< /script>"
Page.RegisterStartupScript ("memRepHe lp", sCommand)
End If
Here's the Page Load for memRepHelp.aspx:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim si As WebUserSession
si = WebUserSession.SessionInfo Get()
If Not Page.IsPostBack Then
Dim ds As DataSet = MemberSystem.GetInstance() .GetRepHel pSummary(s i.MemberNu mber)
CreateHeader(ds)
CreatePopUpMessages(ds)
End If
End Sub
Here's the HTML from memRepHelp.aspx:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>memRepHelp</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScri pt">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="/Styles.css" type="text/css" rel="stylesheet">
</HEAD>
<body MS_POSITIONING="GridLayout ">
<uc1:memwindowtitle id="MemWindowTitle1" title="Rep Help" runat="server"></uc1:memwi ndowtitle>
<form id="Form1" method="post" runat="server">
<div class="PopDivTagPos" id="PopdivBody" style="Z-INDEX: 100; WIDTH: 350px; HEIGHT: 8.7%">
<div align="left"><asp:panel id="pnlRepHelp" runat="server" Width="350px"></asp:panel> </div>
<DIV align="right">
<INPUT onclick="window.close();" type="button" value="Close">
</DIV>
</div>
</form>
</body>
</HTML>
Problem: The second time Overview.aspx opens the ModalDialog memRepHelp.aspx the code-behind for memRepHelp.aspx is not executed. memRepHelp.aspx displays showing the old data from the first time it was displayed.
Here's the code from Overview.aspx:
If Not Page.IsPostBack Then
'popup Rep Help window
Dim sCommand As String = "<script language=javascript>window
Page.RegisterStartupScript
End If
Here's the Page Load for memRepHelp.aspx:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim si As WebUserSession
si = WebUserSession.SessionInfo
If Not Page.IsPostBack Then
Dim ds As DataSet = MemberSystem.GetInstance()
CreateHeader(ds)
CreatePopUpMessages(ds)
End If
End Sub
Here's the HTML from memRepHelp.aspx:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>memRepHelp</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScri
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="/Styles.css" type="text/css" rel="stylesheet">
</HEAD>
<body MS_POSITIONING="GridLayout
<uc1:memwindowtitle id="MemWindowTitle1" title="Rep Help" runat="server"></uc1:memwi
<form id="Form1" method="post" runat="server">
<div class="PopDivTagPos" id="PopdivBody" style="Z-INDEX: 100; WIDTH: 350px; HEIGHT: 8.7%">
<div align="left"><asp:panel id="pnlRepHelp" runat="server" Width="350px"></asp:panel>
<DIV align="right">
<INPUT onclick="window.close();" type="button" value="Close">
</DIV>
</div>
</form>
</body>
</HTML>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The purpose of this code is to open the popup window, memRepHelp.aspx (using window.showModalDialog) everytime the page Overview.aspx is loaded. It works fine the first time. The screen popsup, gets the current member number, calls the database and displays the member's information. When the user is done looking at the info they close the popup window (<INPUT onclick="window.close();" type="button" value="Close">
)
When Overview.aspx is loaded with a new member number the popup, memRepHelp.aspx, is displayed but the code behind never executes and the info for the last member number is still displayed. So I am trying to figure out why the code behind doesn't execute on subsequent executions of
"<script language=javascript>window .showModal Dialog ('/member/memRepHelp.aspx' , '','dialogHeight:500px;dia logWidth:3 85px;scrol lbars:no;h elp:no');< /script>"
)
When Overview.aspx is loaded with a new member number the popup, memRepHelp.aspx, is displayed but the code behind never executes and the info for the last member number is still displayed. So I am trying to figure out why the code behind doesn't execute on subsequent executions of
"<script language=javascript>window
but u have rgisterered the script under "not ispostback" .. so what happens when the page is submitted .. u do not want the popup to shown? also the script regsitered seems to open the modal window when the page is loaded .. not written within any function .. so what exactly r u trying to do?