Solved

Problem with RegisterStartupScript and showModalDialog

Posted on 2004-10-20
3
1,179 Views
Last Modified: 2008-01-09
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.showModalDialog             ('/member/memRepHelp.aspx', '','dialogHeight:500px;dialogWidth:385px;scrollbars:no;help:no');</script>"
            Page.RegisterStartupScript("memRepHelp", 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.SessionInfoGet()
        If Not Page.IsPostBack Then
            Dim ds As DataSet = MemberSystem.GetInstance().GetRepHelpSummary(si.MemberNumber)
            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_defaultClientScript">
            <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:memwindowtitle>
            <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>
0
Comment
Question by:thespiceman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 20

Accepted Solution

by:
jitganguly earned 500 total points
ID: 12364611
Instead of Modal have you tried window.open ?

In the past I had difficulty submitting from modal window

See my question here http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20272287.html
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12367573
the code looks fine .. it should work ...
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?
0
 

Author Comment

by:thespiceman
ID: 12371960
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.showModalDialog             ('/member/memRepHelp.aspx', '','dialogHeight:500px;dialogWidth:385px;scrollbars:no;help:no');</script>"
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Display first 3 lines of text from database field, vbscript asp 4 62
Hide cell in a table 2 33
Reg Exp to extract Url from string asp 12 36
Validating Date 4 28
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question