Open Window from Code behind.

7 posts, 0 answers
  1. Grzesiek
    Grzesiek avatar
    94 posts
    Member since:
    Jun 2007

    Posted 06 Oct 2009 Link to this post

    Hello!

    Before I wrote this topic I had a problem with opening RadWindow which was located in ContentPlaceHolder (under MasterPage).

    The problem was solved by:
     OpenerElementID='<%# preview.ClientID %>' 




    But using this way I can't force preview_Button click procedure.

    In child page I have:

     <asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate> 
     <asp:Button ID="preview" runat="server" Text="Podgląd"/> 
     </ContentTemplate></asp:UpdatePanel> 
        <telerik:RadWindowManager ID="RWM2" runat="server"
            <Windows> 
                <telerik:RadWindow ID="RW2" Overlay="true" runat="server" VisibleOnPageLoad="False" 
                    Modal="true" NavigateUrl="~/modules/forum/controls/podglad.aspx" Skin="WebBlue" VisibleStatusbar="true" 
                    VisibleTitlebar="true" Behavior="Close, Reload, Move" Width="450" Height="350"
                </telerik:RadWindow> 
            </Windows> 
        </telerik:RadWindowManager> 

    Code behind:
     Protected Sub preview_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles preview.Click 
            Session("preview") = content_box.Text 
    End Sub 

    With OpenerElementID='<%# preview.ClientID %>'  the window is showing correctly, but I the preview_Click doesn't fire up.

    Without this I can't get the Rad Window to show up.

    How to start preview_Click and after that show Rad Window (RW2) ?
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 06 Oct 2009 Link to this post

    Hi Grzesiek,

    The OpenerElementID functionality uses the page's binding mechanism and is intended to be used in simple scenarios only. If you have set some server-side element for an opener element, its server-side eventhandler will not be fired - this behavior cannot be changed. In scenario like yours, I would suggest to open the RadWindow control directly from the codebehind by setting its VisibleOnPageLoad property to true. More information on the subject is available here.

    All the best,
    Georgi Tunev
    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.
  3. Grzesiek
    Grzesiek avatar
    94 posts
    Member since:
    Jun 2007

    Posted 06 Oct 2009 Link to this post

    But I don't want to postback the page.

    I tried this way:

            Dim scriptstring As String = "radopen('../../modules/forum/controls/podglad.aspx', 'RW2');" 
            ScriptManager.RegisterStartupScript(MeMe.[GetType](), "radopen", scriptstring, True
     

    It works - I mean the page is opening, and the value which I set in preview_click is loading.

    But the Window ignores Skin and size. Simple window without any options I set.
  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 07 Oct 2009 Link to this post

    Hi Grzesiek,

    I am not quite sure that I understand you correctly. What do you mean by "I don't want to postback the page"? From the initial information, I assumed that you want to click the button, execute a server-side code in preview_Click and open a RadWindow at the same time. You could do that by opening the RadWindow from the server in your preview_Click function as I suggested in my previous reply. If you want to avoid the postback, you could use Ajax / RadAjax for this purpose, but the logic for opening the RadWindow will again be the same.
    As for the last problem, make sure that you have only one RadWindowManager rendered on the page. radopen, radalert, radconfirm and the other RadWindowManager's function are always using the RadWindowManager that is first rendered on the page. Also please note that when using RadWindows declared in the RadWindowManager's collection, the skin for this windows will be the same and it should be set to the RadWindowManager. If you want to have different skins for RadWindow on the same page, you should declare standalone RadWindow controls.


    Regards,
    Georgi Tunev
    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.
  5. Grzesiek
    Grzesiek avatar
    94 posts
    Member since:
    Jun 2007

    Posted 07 Oct 2009 Link to this post

    So I don't know now what I have to do.

    I have master page "forum_master.master".

    I put the web user control (sign_out.ascx) to this master page. The user control have RadWindowManager with RadWindow.

    <telerik:RadWindow ID="RW1" Overlay="false" runat="server" VisibleOnPageLoad="False" 
        Modal="false" NavigateUrl="~/controls/powiadomienia.aspx" Skin="WebBlue" VisibleStatusbar="false" 
        Behavior="Close, Reload, Move" Width="450" Height="350" EnableEmbeddedScripts="False"
    </telerik:RadWindow> 
    Everything works fine - RadWindow "RW1" is opening by this function:

    <script type="text/javascript"
        function ShowPow() { 
            window.radopen(null"RW1");     
        } 
    </script> 

    Now I have child page "forum_topic.aspx". And I have another RadWindowManager with RadWindow:
        <telerik:RadWindowManager ID="RWM2" runat="server"
            <Windows> 
                <telerik:RadWindow ID="RW2" Overlay="true" runat="server" VisibleOnPageLoad="False" 
                    Modal="true" NavigateUrl="~/modules/forum/controls/preview.aspx" Skin="WebBlue" VisibleStatusbar="true" 
                    VisibleTitlebar="true" Behavior="Close, Reload, Move" Width="600" Height="350"
                </telerik:RadWindow> 
            </Windows> 
        </telerik:RadWindowManager> 

    From code behind I show RadWindow "RW2" by this function:
     Dim scriptstring As String = "radopen('../../modules/forum/controls/preview.aspx', 'RW2');" 
            ScriptManager.RegisterStartupScript(MeMe.[GetType](), "radopen", scriptstring, True

    Both windows are opening, but the second is without set parameters (Behaviors, style, etc.).

    When I remove the first RadWindowManager - RMW1 - and leave only RadWindow in user control (sign_out.ascx) the second RadWindow is showing correctly, but then the first is broken (no style as previous in RW2).

    I tried to put one RadWindowManager on master page (forum_master.master) and leave only RadWindows control, but it's not working.

    Any ideas?


  6. Grzesiek
    Grzesiek avatar
    94 posts
    Member since:
    Jun 2007

    Posted 08 Oct 2009 Link to this post

    When I put the second RadWindow both works fine.

    This is the only solution for my problem?
  7. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 08 Oct 2009 Link to this post

    Hello Grzesiek,

    Please open a support ticket and send me a sample project that reproduces your exact setup along with the problem itself. I will check and fix it for you.


    Kind regards,
    Georgi Tunev
    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.
Back to Top