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

Problem Opening Radwindow with ContentTemplate

4 Answers 296 Views
Window
This is a migrated thread and some comments may be shown as answers.
Prava kafle
Top achievements
Rank 1
Prava kafle asked on 06 Jan 2011, 05:41 PM
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

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 07 Jan 2011, 07:21 AM
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.
0
Prava kafle
Top achievements
Rank 1
answered on 07 Jan 2011, 03:05 PM
Hi Shinu,

It worked like a charm.

Thanks,
Prava
0
Fabio Laserra
Top achievements
Rank 1
answered on 13 Nov 2011, 10:50 AM
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...
0
Marin Bratanov
Telerik team
answered on 15 Nov 2011, 10:17 AM
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
Tags
Window
Asked by
Prava kafle
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Prava kafle
Top achievements
Rank 1
Fabio Laserra
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or