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

RadWindow Positioning issue (Q2 2008)

6 Answers 119 Views
Window
This is a migrated thread and some comments may be shown as answers.
AndreaT
Top achievements
Rank 1
AndreaT asked on 21 Aug 2008, 08:23 AM
Hi,

I have a content page (its master page has rather simple html) which has a RadGrid with window editing. I followed examples and manual pages but I cannot position my window correctly, it always displays centered.

<telerik:RadWindowManager ID="RadWindowManager1" runat="server"  Skin="Web20"
    <Windows> 
        <telerik:RadWindow ID="EditDialogWnd" runat="server" Title="Edit" ShowContentDuringLoad="false" 
                 ReloadOnShow="true" Modal="true" Width="400" Height="400" OffsetElementID="OffsetElement" Top="0" Left="0"/> 
    </Windows> 
</telerik:RadWindowManager> 

OffsetElement is a simple DIV on top of the content page. The window is called to display with:

<CommandItemTemplate> 
    <div style="padding:10px 0px;"
        <asp:LinkButton ID="HlInsertNew" runat="server" OnClientClick="ShowInsertForm('EditFormSA.aspx?type=cliente'); return false;"><img style="border:0px;vertical-align:middle;" alt="" src="images/AddRecord.gif" /> Inserisci Nuovo</asp:LinkButton> 
    </div> 
</CommandItemTemplate> 

and the script that actually opens the window is (cut&pasted directly from example sources):

<Telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
        <script type="text/javascript"
            function ShowEditForm(id, rowIndex, editFormUrl) 
            { 
                var grid = $find("<%= RadGrid1.ClientID %>"); 
                 
                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();                 
                grid.get_masterTableView().selectItem(rowControl, true); 
                         
                //window.radopen("EditFormCS.aspx?EmployeeID=" + id, "UserListDialog"); 
                window.radopen(editFormUrl, "EditDialogWnd"); 
                return false;  
            } 
            function ShowInsertForm(editFormUrl) 
            { 
               window.radopen(editFormUrl, "EditDialogWnd"); 
               return false; 
            } 
            function refreshGrid(arg) 
            { 
                if(!arg) 
                { 
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");                  
                } 
                else 
                { 
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");                   
                } 
            } 
        </script> 
    </Telerik:RadCodeBlock> 

no way, the window is always centered.

Any clue?

Lorenzo

6 Answers, 1 is accepted

Sort by
0
AndreaT
Top achievements
Rank 1
answered on 21 Aug 2008, 03:41 PM

I found that the problem occurs only whe Modal="true" is set.

Lorenzo.
0
Georgi Tunev
Telerik team
answered on 22 Aug 2008, 05:35 AM
Hello Lorenzo,

This is expected behavior - a modal RadWindow will always be initially positioned at the center of the page. If you wish to move it to a different position, you need to use the moveTo() client-side method after the RadWindow is shown.



Sincerely yours,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
AndreaT
Top achievements
Rank 1
answered on 22 Aug 2008, 06:22 AM
Geogi,  I don't undestand why a modal window should not be initially freely positioned. As far as I know a modal window is nothing else than a window that blocks the opener window, nothing special.

I am quite sure that in the 2007 version of ASP.NET controls does not have this behaviour: a modal window can be positioned just like a non-modal one.

Lorenzo


0
Georgi Tunev
Telerik team
answered on 22 Aug 2008, 08:38 AM
Hello Lorenzo,

Yes, there was such behavior in previous versions of the controls, but the logic was changed after that to conform to the idea of a modal window - to block the other content and to appear in the center of the page so you can see it. This is the behavior you will experience in any OS when a modal dialog is shown. We also received such requests from a number of customers which lead to the changed logic.


Best wishes,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
AndreaT
Top achievements
Rank 1
answered on 22 Aug 2008, 08:53 AM
Thank you for your reply Georgi. I Understand and I will comform to this.

Anyway, let me say that the default behaviuor is fine,indeed. I found that all my troubles came from the use of an page autoresize script fired by body onload event of the loaded page. This messed up th default positioning.

I have pages that dinamically load usercontrols that have very differet sizes, I cannot set the radwindow initial size because I dont know at design time the real dimension on the loaded page and I would avoid that my  users have to resize that windows.

Lorenzo



0
Georgi Tunev
Telerik team
answered on 25 Aug 2008, 10:27 AM
Hi Lorenzo,

We are working on a "FitToSize" property for the RadWindow that would do this automatically if the content page is in the same application (if this is an external page, the browser's security mechanism will not allow that). This will happen in one of the following version of the control - most probably in Q3.
For the time being you can check the following KB article - it is for RadWindow for ASP.NET but the logic is still the same:
http://www.telerik.com/support/kb/article/b454K-gtc-b454T-a-b454c-a.aspx




Greetings,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
AndreaT
Top achievements
Rank 1
Answers by
AndreaT
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or