RadWindow to open an Embedded User Control
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")]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); 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
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 );<telerik:RadWindow ID="popFlashPlayer" runat="server" VisibleOnPageLoad="false" Modal="true"> <ContentTemplate> <asp:Panel ID="pnlFlash" runat="server"></asp:Panel> </ContentTemplate></telerik:RadWindow><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>