Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PopUp Window onload

Posted on 2003-10-23
5
Medium Priority
?
542 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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

670 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