Solved

PopUp Window onload

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I bind a WPF ComboBox to an ItemSource using XAML? 2 28
FInd Image Control Gridview 3 33
Change to file doesn't show up 16 73
MYSQL responding very slow 3 48
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…

680 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