radopen modal issue

7 posts, 1 answers
  1. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 07 Mar 2012 Link to this post

    Hi All,

    i have page that is dividedusing radsplitter and radpanes...

    i have in the left pane a rad tree view control, on each node it it when clicked, i open another new page in the right pane....

    this page in the right pane has radgrid to get some data in the data base, i have link button on each row on which when clicked i open a rad window using this javascript function... i attach this js function on the onclick attribute of the link button in the grid databound event.

    function ShowEditForm(id, rowIndex, sTitle, sStatusText) {
                       var grid = $find("<%= gvTasks.ClientID %>");
                       var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                       grid.get_masterTableView().selectItem(rowControl, true);
                    
                       var x = window.radopen("TasksPage.aspx, "TaskTabs");
                       x.set_title(sTitle);
                       x.maximize();
                        
                      return false;
                   }


    and this is my RadWinodwManager tag

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
               <Windows>
                   <telerik:RadWindow ID="TaskTabs" runat="server" Title="Editing record" Height="485px"
                       Width="1100px" left="0px" ReloadOnShow="false" ShowContentDuringLoad="false" 
                       Modal="true" VisibleStatusbar="True" Behaviors="Close, Maximize, Reload"    >
                       </telerik:RadWindow>
                            
               </Windows>
           </telerik:RadWindowManager>


    all is good and the window is opened and maximized as expected in the right pane and it is modal.

    while doing testing, i noticed that and while the winodw is opened, i can click on any tree node in the tree view in the left pane and as excpected the navigated page is opened in the right pane.

    what i need is how to prevent clicking on  any tree mode while this window is opened!!!! i need it to be modal on the whole main page not just on the right pane page????

    please help...
    thanks in advanced....
    Asa'ad...
  2. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 08 Mar 2012 Link to this post

    please help....
  3. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5363 posts

    Posted 08 Mar 2012 Link to this post

    Hello Asa'ad,

    The extenal page you load in the right pane is actually in an iframe, so it has separate window and document objects from the main page. This means that a RadWindow opened inside it cannot be aware of the context of the main page and cannot take its HTML elements outside of the frame.

    The way to work around this is to open the RadWindow from the topmost frame, similar issue and approach are described here, here and here. These resources are for the case when the container is a RadWIndow, but they show the general concept. You can simply use window.top or window.parent to reference the main frame.

    In case you need feedback from the RadWindow to the content page you can use the approach for calling functions between frames described here. Just modify it a bit to use the RadPane's Client-side API (and more precisely the getExtContentElement() method) to get a reference to the iframe.


    All the best,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  4. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 11 Mar 2012 Link to this post

    Hi Marin...
    the solution u suggested is very good, nut my application design force me to open this the record edit form in the right pane only not on over the whole page...so i cannot call it as you suggested...

    and the reason i want to prevent uesers from clicking on any tree node while openeing the edit form, is that i need to do something on database information if the user exits this window, i succeed doing this using an exit button on the edit form click event and also on the rad window onclient close event...

    the problem is that i cannot do this database update if user navigate away from the edit form by clicking the tree node.

    i tried to call the onbeforeunload event on the body of the page called in the edit form...this was  good solution, but the onbeforeunload confirm dialog is realy annoying and so user has to click ok to navigate away or cancel to stay...
    aslo this event is fired twice this i am usig a link button to open this form!!!

    i searched the net regarding this issues and didn't find any working solution!!!
    i need to prevent showing this confirmation message,and not to fire the onbeforeunload twice???

    many thanks
    Asa'ad...
  5. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 13 Mar 2012 Link to this post

    Any suggestion please...
  6. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    5363 posts

    Posted 13 Mar 2012 Link to this post

    Hello Asa'ad,

    If you want to disable the main page then you must perform some action in this parent page, because, as I already explained, you cannot take elements outside of an iframe. The best approach is to open the RadWindow form the main page as this would allow it to move in the entire browser window. In case you do not want this I can suggest that you call a function from the main page that will disable the treeview as shown here (look for the set_enabled() method). You can call this function in the OnClientShow event of the RadWindow by using window.top.myFunctioName() and in its OnClientClose event as well so that you enable the treeview again. You may also inspect the approach described in this KB article for creating a custom modal backgrouind. You can place the modal div in the left pane to cover only the treeview and not the right pane (iframe) where you RadWindow is.


    Greetings,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  7. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 14 Mar 2012 Link to this post

    many thank Marin...
    the set_enabled() method has solved my problem...

    best regards
    Asa'ad...
Back to Top