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

Always maximized

8 Answers 212 Views
Window
This is a migrated thread and some comments may be shown as answers.
Pete
Top achievements
Rank 1
Pete asked on 06 Feb 2009, 01:26 PM
Hi,

Is it possible to somehow set the RadWindow to be always in maximized state?

I have a window which should be always maximized and I defined the window behaviours like the following. This works ok when I open the window at the first time but if I close the window and open it again it is in "normal" state and not maximized anymore.

    InitialBehavior

 

="Maximize"

 

 

    Behavior="Maximize"

Regards,
Pete

 

8 Answers, 1 is accepted

Sort by
0
Accepted
Fiko
Telerik team
answered on 09 Feb 2009, 07:51 AM
Hello Pete,

You can achieve this behavior by using the client side API  of the RadWindow control as follow :
  • attach an event handler to the OnClientShow event of the Radwindow control
<telerik:RadWindow 
runat="server"  
ID="RadWindow1" 
OnClientShow="onRadWindowShow" 
VisibleOnPageLoad="true"
</telerik:RadWindow> 

  •  in the attached function  call maximize() method of the Radwindow object with boolean parameter 'true' :
<script type="text/javascript"
function onRadWindowShow(sender, arg) 
    sender.maximize(true); 
</script> 

I hope this helps.

Sincerely yours,
Fiko
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Pete
Top achievements
Rank 1
answered on 09 Feb 2009, 08:19 AM
Yep, it worked and was that easy :-)

Thanks
Pete
0
Johann Herunter
Top achievements
Rank 1
answered on 08 Jan 2010, 09:40 AM
Hello,

I'm using the RadWindow with the Modal Property set to "true" and need to open the rad window always maximized.

But, when using exact the same logic provided in this post, the first click works fine. But the next click opens the RadWindow shows a totally grayed window with read-only behaviour. As it is the window that should be disabled.

How do I open a new RadWindow always in maximized mode, when the window needs to be modal? Are there additional properties to set when using modal mode? I've tried to set the maximize flag to false in the close event handler, but that didn't solved the problem.

When the opener window is refreshed, the RadWindow opens fine again. But why do I need to refresh the opener window?


Greetings
Johann
0
Svetlina Anati
Telerik team
answered on 12 Jan 2010, 10:53 AM
Hello Johann,

Please, note that the scenario of having a RadWindow which is maximized and modal at the same time is invalid - if it is maximized, it occupies all the available space and the underlying content is not accessible while the modality is used exactly for  disabling the rest of the page - as you see, there is a logical problem because you try to disable something which is already unaccessible.

What actually happens is that by default at the moment when a RadWindow is maximized, it receives a very big z-index in order to show it on top of everything and the modal background forms its z-index based on the z-index of the RadWindow. However, when you again open the RadWindow the modal background is shown with its already calculated big z-index before the RadWindow has managed to maximize and thus you get the described result. We implemented a new property called ShowOnTopWhenMaximized which will help in fine - tuning this and  it will be available in the official Q1 2010 release which is scheduled for March - if you explicitly set it to false, this should fix the issue.

For the time being I prepared for you a simple workaround which uses the client-side API of the RadWindow control. The idea is to remove the modality when maximizing and to restore it back on every other command - take a look at the following code snippet:

<form id="form1" runat="server"
       <div
           <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
           </telerik:RadScriptManager
           <script type="text/javascript"
           function openWindow() { 
               var oWnd = $find('<%= radW.ClientId %>'); 
               oWnd.SetUrl('test1.aspx'); 
               oWnd.Show(); 
               //oWnd.Maximize();  ' this call had to be disabled, because it was causing the RadWindow to be positioned badly when browser window size was smaller than page size (scrollbars visible). 
               return false; 
           
           // as instructed, we call Maximize in the clientPageLoad event of RadWindow 
           function windowClientPageLoad(sender, eventArgs) { 
           sender.set_modal(false); 
               sender.Maximize(); 
           
               
        function OnClientCommand(sender, args) 
        
         if(args.get_commandName() != "Maximize") 
         
            sender.set_modal(true); 
         
         else 
         
           sender.set_modal(false); 
         
              
        
            
           </script
           <asp:LinkButton ID="btnOpen" Text="Open RadWindow" runat="server" OnClientClick="return openWindow();" /> 
           <telerik:RadWindow ID="radW" runat="server" VisibleStatusbar="false" Modal="true"
               KeepInScreenBounds="true" OnClientCommand="OnClientCommand" OnClientPageLoad="windowClientPageLoad" /> 
       </div>


I tested this solution locally and it fixed the problem - please use this as a start point and adapt it to your scenario and let me know how it goes.




Sincerely yours,
Svetlina
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Johann Herunter
Top achievements
Rank 1
answered on 14 Jan 2010, 04:18 PM
Hello Svetlina,

I've tested the sample logic provided. It works good when setting the >InitialBehaviours="Maximize"< parameter on the RadWindow, because the new window is flickering when set only with the JS. But each subsequent call opens the new window in maximized mode as expected. :)

But, without using the Maximized mode (commented the Maximize() call and removing the InitialBehaviours attribute) the following behaviour can be reproduced:

1.) Open Window
2.) Maximize with the Icon
3.) Restore window

As result the complete screen is put into modal mode, the RAD window including so that only a browser refresh is possible to reset the page.

Is it possible to overcome this problem with js logic? The Maximized logic can be used in our case, but maybe a request comes to open the window so that the underlying page is visible. With this request it must then be possible to maximize and restore the page as needed.

Btw., we use "window.radopen" to open the new window. Is there a difference than the way you open it?

Thanks for your support!

Sincerely
Johann
0
Svetlina Anati
Telerik team
answered on 19 Jan 2010, 04:04 PM
Hello Johann,

Thank you for the detailed reproduction steps, I was able to reproduce the issue. It is caused by the already mentioned fact that the z-index of the maximized RadWindow is very big and it determines the modal overlay z-index. In order to fix the issue, please set a z-index bigger  than 100000 as shown below:


<form id="form1" runat="server">
     <div>
         <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
         </telerik:RadScriptManager>
         <script type="text/javascript">  
        function openWindow() {  
            var oWnd = $find('<%= radW.ClientID %>');  
            oWnd.SetUrl('test1.aspx');  
            oWnd.Show();  
            //oWnd.Maximize();  ' this call had to be disabled, because it was causing the RadWindow to be positioned badly when browser window size was smaller than page size (scrollbars visible).  
            return false;  
        }  
        // as instructed, we call Maximize in the clientPageLoad event of RadWindow  
        function windowClientPageLoad(sender, eventArgs) {  
       // sender.set_modal(false);  
           // sender.Maximize();  
        }  
              
     function OnClientCommand(sender, args)  
     {  
      if(args.get_commandName() != "Maximize")  
      {  
         sender.set_modal(true);  
      }  
      else  
      {  
        sender.set_modal(false);  
      }  
             
     }  
           
         </script>
         <asp:LinkButton ID="btnOpen" Text="Open RadWindow" runat="server" OnClientClick="return openWindow();" />
         <telerik:RadWindow ID="radW" style="z-index:100001" runat="server" VisibleStatusbar="false" Modal="true"
             KeepInScreenBounds="true" OnClientCommand="OnClientCommand" OnClientPageLoad="windowClientPageLoad" />
     </div>
 </form>

However, you are saying that you use the radopen method and this means that you are using a RadWindowManager - if so, please set the z-index in the markup of the manager itself and not to the declared RadWindow.

All the best,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
GACA
Top achievements
Rank 2
answered on 22 Dec 2014, 01:21 PM
function onRadWindowShow(sender, arg) {
     sender.set_modal(false);
     sender.maximize(true);
     sender.set_modal(true);
 }
0
Hemant
Top achievements
Rank 1
answered on 13 Mar 2015, 12:01 PM
Thanks, this is working
Tags
Window
Asked by
Pete
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Pete
Top achievements
Rank 1
Johann Herunter
Top achievements
Rank 1
Svetlina Anati
Telerik team
GACA
Top achievements
Rank 2
Hemant
Top achievements
Rank 1
Share this question
or