RadWindow to open an Embedded User Control

Posted by Community Admin on 05-Aug-2018 19:45

RadWindow to open an Embedded User Control

All Replies

Posted by Community Admin on 28-Feb-2011 00:00

I want to have a RadWindow open a Embedded User Control from my custom user control instead of using some static page for the navigateurl. Is there a special contenttype for .ascx? I got the window to open the embedded resource I want but it is displayed in plain html.

AssemblyInfo.cs

[assembly: WebResource("Image.Resources.Views.UploadImage.ascx", "text/html;charset=utf-8")]

Main.cs
void RadButton1_Click(object sender, EventArgs e)
        
            RadWindow testWindow = new RadWindow();
            testWindow.VisibleOnPageLoad = true;
            testWindow.Skin = "Sitefinity";
            ClientScriptManager cs = Page.ClientScript;
            Type rsType = this.GetType();
            testWindow.NavigateUrl = cs.GetWebResourceUrl(rsType, "Image.Resources.Views.UploadImage.ascx");
 
            RadWindowManager1.Windows.Add(testWindow);
        

Posted by Community Admin on 04-Mar-2011 00:00

Hello Kristian,

The RadWidnow by default can either serve as an IFrame (when using navigate url) or you can use it as a NamingContainer and make it load content from the currently rendered html. You need to use the second approach and add an ASP.NET Panel to the ContentTemplate of the widnow. Then in this panel you can load embedded controls.

Greetings,
Radoslav Georgiev
the Telerik team

Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!

Posted by Community Admin on 23-Jun-2011 00:00

I am able to open a RadWindow from a ImageButton Click Event (ImageButton is located inside a Repeater) using this code:

popFlashPlayer.VisibleOnPageLoad = true;
ImageButton test = sender as ImageButton;
var ctrl = Page.LoadControl(string.Format("0DesktopModules/Touchstone.PT.VW.Web/Passat/Views/VideoVoting/FlashView.ascx", BaseUrl));
((FlashView)ctrl).LoadFlash(int.Parse(test.Attributes["objectiveId"]));
 
var panel = popFlashPlayer.ContentContainer.FindControl( "pnlFlash" );
panel.Controls.Add( ctrl );

code for RadWindow on main page:
<telerik:RadWindow ID="popFlashPlayer" runat="server" VisibleOnPageLoad="false" Modal="true">
    <ContentTemplate>
        <asp:Panel ID="pnlFlash" runat="server"></asp:Panel>
    </ContentTemplate>
</telerik:RadWindow>

code for RadAjaxManager on main page:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdatePanelsRenderMode="Inline">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rptVideoVotingObjectives">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="popFlashPlayer" LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="pnlFlash" LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="lblError" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="popFlashPlayer">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="popFlashPlayer" LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="pnlFlash" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="btnTest">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="popFlashPlayer" LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="pnlFlash" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

my code for LoadFlash in the loaded usercontrol executes, and everything works fine on the load

The FlashView.ascx contains a button, but it's click event does not fire, The RadWindow closes briefly, then reopens as a blank page.

Any insights why this may be happening?

This thread is closed