Solved

PopUp Window onload

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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
localhost: This site can’t be reached  localhost refused to connect. 2 197
abstract class C# 1 31
Install IIS7.5 on Windows Sever 2012 R2 4 23
Code enhancement 4 21
Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
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…
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…

839 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