This is a migrated thread and some comments may be shown as answers.

Popup Window

10 Answers 284 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
JanTe
Top achievements
Rank 1
JanTe asked on 18 Apr 2008, 12:12 AM
Hi,

I have a form containing a toolbar which traps a client-side event to call a window.open to open up a popup window. On the popup window i have the same set up; where i want to open yet another popup window using the toolbar and client-side event to call window.open.

what i am finding is that the second popup does not open up, although the code seems to get called.

Please help.

Jan

10 Answers, 1 is accepted

Sort by
0
Shaun Peet
Top achievements
Rank 2
answered on 18 Apr 2008, 12:24 AM
Hello, please post your code so we can try to help.
0
JanTe
Top achievements
Rank 1
answered on 18 Apr 2008, 12:50 AM

Hi,

how do i do post my code? do you have a facility to attach sample code or do i paste into the text? i have multiple pages that play together.

Thanks,

Jan

0
Shaun Peet
Top achievements
Rank 2
answered on 18 Apr 2008, 01:43 AM
The best way is to post the relevant snippets of your code by using the "FormatCodeBlock" tool which is built into the editor for composing these forum posts.  It is the second from the right on the top toolbar.
0
JanTe
Top achievements
Rank 1
answered on 18 Apr 2008, 02:42 AM
Hi,

the toolbar defnition..

<rad:RadToolbar ID="ToolBarRole" runat="server" UseFadeEffect="false" ImagesDir="~/images/">  
 <items> 
  <rad:RadToolbarButton ID="cmdNewRole" DisplayType="TextImage" ToolTip="Add a new Data  Source Table" CommandName="cmdNewRole" ButtonText="New Data Source Table" ButtonImage="new.gif" /> 
 </items> 
</rad:RadToolbar> 

Here is the code...

<script type="text/javascript">  
            <!--  
                //Get the ToolBar Handle and Set the Event.  
                mIntID = "<%=ToolBarRole.ClientID%>";                                      
                mObjToolBar =  document.getElementById(mIntID);  
                <%= ToolBarRole.ClientID %>.attachEvent("OnClientClick","click_handler");  
                  
                function click_handler(sender, e)  
                {  
                    if (sender.CommandName == "cmdNewRole")  
                    {  
                        //Get the Screen Resolution and Determine How large to make the Window  
                        var mScreenHeight = screen.height * 0.6;  
                        var mScreenWidth = screen.width * 0.6;  
                        //Center the Form   
                        var mFormLeft = (screen.width - mScreenWidth)/2;  
                        var mFormTop = (screen.height - mScreenHeight)/2;  
                        //Show the Form.  
                        window.open("Details.aspx?Action=New","Role","left=" + mFormLeft + ",top=" + mFormTop +",height=" +  mScreenHeight + ",width=" + mScreenWidth +",scrollbars=no,menubar=no,toolbar=no,resizable=yes");  
                    }  
                }  
            --> 
</script> 

I have this on the first page (default.aspx) and on the popup page (details.aspx). on the details.aspx teh alert shows but the window.open  fails. I am trying to show two different pages. In other words, default.aspx calls window.open to open details.aspx which calls window.open to open second.aspx (which fails).

your help is much appreciated!

Jan
0
Erjan Gavalji
Telerik team
answered on 18 Apr 2008, 05:46 AM
Hi JanTe,

The window is actually opened, but it gets opened in the same container. This happens because of the window name parameter (the second parameter to the window.open method). You can overcome this by specifying a different name for the new window in the popup page.

I hope this helps.

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JanTe
Top achievements
Rank 1
answered on 18 Apr 2008, 06:49 AM
Hi,

problem solved. Thanks very much...Great Response turn around

Jan
0
Liu Peng
Top achievements
Rank 1
answered on 04 Feb 2009, 02:56 AM
Hi,

I using RadToolBar do the same thing: using window.open to open a new window, my problem is that on FireFox(v3.0.5) the new popup  window will be not the active window, it will hide behind the parent window.
please look at my codes:
<telerik:RadToolBar ID="RadToolBar1" runat="server"
        <Items> 
            <telerik:RadToolBarButton Text="Button1" NavigateUrl="http://www.google.com/"></telerik:RadToolBarButton> 
            <telerik:RadToolBarButton Text="Button2" NavigateUrl="javascript:voidOpenCustomizedLists();"></telerik:RadToolBarButton> 
        </Items> 
        </telerik:RadToolBar>

function voidOpenCustomizedLists() 
    window.open("http://www.google.com/","_blank","top=50px,left=50px,height=650px,width=900px,resizable=yes,status=yes",false); 

this problem only appear on FireFox, IE is will.

thanks,
LP





0
Yana
Telerik team
answered on 04 Feb 2009, 11:08 AM
Hello Liu,

I suggest you focus the opened window like this:

function voidOpenCustomizedLists()    
{    
    var win = window.open("http://www.google.com/","test","top=50px,left=50px,height=650px,width=900px,resizable=yes,status=yes"true);    
    win.focus();  
}  
 
 

Best regards,
Yana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Liu Peng
Top achievements
Rank 1
answered on 05 Feb 2009, 01:53 AM
Hello,

Yes, It can solve my problem, thanks, I think the above will be more simple:
function voidOpenCustomizedLists()     
{     
    window.open("http://www.google.com/","test","top=50px,left=50px,height=650px,width=900px,resizable=yes,status=yes"true).focus()

Could you tell me the reason about we must call the focus() clearly? And this problem only occur with RadToolBar on FireFox, Is it a bug
for RadToolBar?

regards,
LP
0
Yana
Telerik team
answered on 05 Feb 2009, 07:06 AM
Hi Liu,

We'll investigate the reason for this issue in RadToolBar.

Kind regards,
Yana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ToolBar
Asked by
JanTe
Top achievements
Rank 1
Answers by
Shaun Peet
Top achievements
Rank 2
JanTe
Top achievements
Rank 1
Erjan Gavalji
Telerik team
Liu Peng
Top achievements
Rank 1
Yana
Telerik team
Share this question
or