+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / RadWindow to open an Embedded User Control

RadWindow to open an Embedded User Control

3 posts, 1 answered
  1. Kristian
    Kristian avatar
    214 posts
    Registered:
    03 Jun 2010
    28 Feb 2011
    Link to this post
    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);
            }

  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    04 Mar 2011
    Link to this post
    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!
    Answered
  3. Brandon
    Brandon avatar
    1 posts
    Registered:
    13 Dec 2010
    23 Jun 2011
    Link to this post
    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("{0}DesktopModules/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?
3 posts, 1 answered