Solved

PopUp Window onload

Posted on 2003-10-23
5
491 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
  • 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now