Problem Opening Radwindow with ContentTemplate

5 posts, 1 answers
  1. Prava kafle
    Prava kafle avatar
    217 posts
    Member since:
    Apr 2010

    Posted 06 Jan 2011 Link to this post

    Hi,

    With client side button click event, I want to open a Radwindow with ContentTemplate . My code looks fine and works perfectly  if I remove the contentment template with navigate url.. Can someone tell me whats wrong in the code given below.

      <telerik:RadWindowManager id="RadWindowManager1" runat="server">
                <Windows >
                        <telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Close,Move" Modal="false" Skin="Office2007" Title="Select User" Width="350"
                            Height="140"    OpenerElementId = "<%# UserBtn.ClientID %>" >
                                <ContentTemplate >
                    
                                     <telerik:RadComboBox ID="ComboBox1" runat="server" Width="130px"   AutoPostBack="True"   >
                                    </telerik:RadComboBox>

                                 </ContentTemplate>
                        </telerik:RadWindow>
                    </Windows>
            </telerik:RadWindowManager>
             

     <telerik:RadButton ID="UserBtn" runat="server" Text="Search"     > </telerik:RadButton>


    Thanks
    Prava
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Jan 2011 Link to this post

    Hello Prava,



    The same scenario worked for me with a small modification done. Give a try with the following code.

    aspx:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Close,Move" Modal="false"
                Skin="Office2007" Title="Select User" Width="350" Height="140" OpenerElementID="UserBtn">
                <ContentTemplate>
                    <telerik:RadComboBox ID="ComboBox1" runat="server" Width="130px" AutoPostBack="True">
                    </telerik:RadComboBox>
                </ContentTemplate>
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <telerik:RadButton ID="UserBtn" runat="server" Text="Search">
    </telerik:RadButton>



    -Shinu.
  3. Prava kafle
    Prava kafle avatar
    217 posts
    Member since:
    Apr 2010

    Posted 07 Jan 2011 Link to this post

    Hi Shinu,

    It worked like a charm.

    Thanks,
    Prava
  4. Fabio Laserra
    Fabio Laserra avatar
    28 posts
    Member since:
    Oct 2009

    Posted 13 Nov 2011 Link to this post

    In my case it does not work. The only ways to open a window in wich there is a contenttemplate is to:

    - add the window to RadWindowManager (but unfortunately I have updatepanels, so it wil not work)
    or
    - invoke the opening of the window with:
    var oWnd = $find("<%= WindowGraficoIstogramma.ClientID %>");
    oWnd.show();
    If I use the common window.radopen I get a new blank window... :(

    anyway it seems that with show method it works...
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4609 posts

    Posted 15 Nov 2011 Link to this post

    Hello Fabio,

    Indeed this method will always work as this is one of the main RadWindow methods. More information on the ways to open a RadWIndow is available in this help article:
    http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html
    and the available Client-side API is listed here:
    http://www.telerik.com/help/aspnet-ajax/window-programming-radwindow-methods.html

    As noted in the first article the radopen method is linked to the RadWindowManager and tries to open a child window of this manager, and since your is not declared there radopen() will create a new instance which will, of course, have none of the content you have in your.

    I would also like to point out that the OpenerElementID property expects the client ID of an HTML element so that it can attach a handler to it, which means the it will not work directly in INaming containers for example. In that case the best approach is to attach a clien-side handler to the desired elemen which will execute a JavaScript function that will in turn call the show() method of the desired RadWindow. You can also try setting this property in the code-behind to the ClientID of the desired server control, but this is likely to prevent the control from posting back or executing other client-side handlers, as OpenerElementId cancels the raw click event.

    Best wishes,
    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
Back to Top