Solved

PopUp Window onload

Posted on 2003-10-23
5
531 Views
Last Modified: 2006-11-17
I want to open a small pop up window when the page first loads.  

I tried doing it as javascript on load on the html page, but the page does postback as I have radio buttons on it, and I don't want the pop up to load everytime the page loads - just the first load.

Does anyone have any ideas how I can do this?

Can I call a client side function from code behind pages?
0
Comment
Question by:Roolee
[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
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
_TAD_ earned 125 total points
ID: 9608158


yuo should put this in your code behind
this is in C#, but is should be pretty easy to change.

I delcare a string, append all my javascript commands to the string and then response.write it out.


private void Page_Load(object sender, System.EventArgs e)
            {

                  if(!IsPostBack)
                  {      
                        String s = null;
                        
                        // Script Header
                        s += "<Script>";
                        //Varibale Declaration
                        //Varibale Declaration
                        s += "var hwnd = window.open('about:blank','Advisor','toolbar=no scrollbars = no location=no width=400 height=200');";
                        s += "hwnd.moveTo(screen.width/4, screen.height/4);";
                        //Property Settings
                        s += "hwnd.document.bgColor = 'lightyellow';";
                        s += "hwnd.document.body.innerHTML = '<b><br> Processing... <br><br><center> Please Wait </center></b>';";
                        //End Function
                        s += "</Script>";
                        //Execute Function
                        Response.Write(s);
                  }
            }
0
 
LVL 22

Expert Comment

by:_TAD_
ID: 9608181


The key in the code is that in the On_PageLoad function you need

if IsPostback = false then


or

If !IsPostback then


command
0
 

Expert Comment

by:Priya25
ID: 9963145
              Dim ParentLoadScript As String
               Dim strURL As String

                If not page.IsPostBack Then
                    strURL = "POREP01.aspx"
                    ParentLoadScript = "<script language=javascript>"
                    ParentLoadScript &= "window.open('" + strURL + "');"
                    ParentLoadScript &= "</" & "script>"
                End If

                If Not IsClientScriptBlockRegistered("ParentLoad") Then
                    RegisterClientScriptBlock("ParentLoad", ParentLoadScript)
                End If


The above should work..Just replace the "POREP01.aspx" with the name of your pop up page..
Regards,
Priya
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10224267
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: _TAD_ {http:#9608158}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 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