Hi,
I have a RadWindow as a usercontrol and when I postback using control inside the RadWindow I get the following error message:
"Two components with the same id 'rwt_RadWindow1_C_UpdateProgress1' can't be added to the application."
This seems to happen when the RadWindow is inside an update panel. I'm also using javascript to open and close the RadWindow because I don't want to call the server when that occurs. Below is an example that I came up with.
Main Page
UserControl Markup
UserControl Code Behind
I can remove the UpdateProgress in this example and it would work, but I need the progress to show on the screen. In my more complicated implementation I have a RadGrid inside the RadWindow and it will complain about duplicate controls as well. Also, if I remove my UpdateProgress here "to get it working", when I do a postback the RadWindow closes and I need to reopen it manually. How do I keep it open after the postback? This doesn't happen if I don't have the outter UpdatePanel.
Thanks!
Gilbert
I have a RadWindow as a usercontrol and when I postback using control inside the RadWindow I get the following error message:
"Two components with the same id 'rwt_RadWindow1_C_UpdateProgress1' can't be added to the application."
This seems to happen when the RadWindow is inside an update panel. I'm also using javascript to open and close the RadWindow because I don't want to call the server when that occurs. Below is an example that I came up with.
Main Page
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Test.Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> <%@ Register Src="RadWindowTest.ascx" TagName="RadWindowTest" TagPrefix="custom" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server"> </ajaxToolkit:ToolkitScriptManager> <asp:UpdatePanel ID="upd" runat="server"> <ContentTemplate> <custom:RadWindowTest ID="rwt" runat="server" /> <br /> <asp:Label ID="dummyLabel" runat="server"></asp:Label> </ContentTemplate> </asp:UpdatePanel> </form> </body> </html> UserControl Markup
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RadWindowTest.ascx.cs" Inherits="Test.RadWindowTest" %> <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> <style type="text/css"> .hidebutton { visibility: hidden; } </style> <a href="#" id="aOpenWindow" runat="server" onclick="openWin(); return false;">Open Window</a> <telerik:RadWindow ID="RadWindow1" runat="server" Modal="True" Width="1000px" Height="600px" AutoSize="false" Skin="Office2007" Animation="None" Behaviors="Move,Close" KeepInScreenBounds="true" ReloadOnShow="false" VisibleStatusbar="False" VisibleTitlebar="True"> <ContentTemplate> <asp:UpdatePanel runat="server" ID="updatepanel"> <ContentTemplate> <br /> <asp:DropDownList ID="DropDown1" runat="server" Width="400px" AutoPostBack="true" OnSelectedIndexChanged="DropDown1_SelectedIndexChanged"> <asp:ListItem Text="File 1" Value="1"></asp:ListItem> <asp:ListItem Text="File 2" Value="2"></asp:ListItem> <asp:ListItem Text="File 3" Value="3"></asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="DropDown2" runat="server" Width="400px" Visible="false" onChange="showLoadButton()"> <asp:ListItem Text="A" Value="A"></asp:ListItem> <asp:ListItem Text="B" Value="B"></asp:ListItem> <asp:ListItem Text="C" Value="C"></asp:ListItem> </asp:DropDownList> <asp:Button ID="LoadData" runat="server" Text="Load" OnClick="LoadData_Click" CssClass="hidebutton" /> <asp:HiddenField ID="hdn" runat="server" Value="" /> </ContentTemplate> </asp:UpdatePanel> <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="updatepanel" runat="server"> <ProgressTemplate> <asp:Panel ID="Panel1" CssClass="overlay" runat="server"> <asp:Panel ID="Panel2" CssClass="loader" runat="server"> <img alt="Loading..." src="/images/ajax-loader.gif" /> </asp:Panel> </asp:Panel> </ProgressTemplate> </asp:UpdateProgress> </ContentTemplate> </telerik:RadWindow> <script language="javascript" type="text/javascript"> if (window.addEventListener) // W3C standard { window.addEventListener('load', load, false); } else if (window.attachEvent) // Microsoft { window.attachEvent('onload', load); } function CloseWindow() { var oWindow = $find("<%= RadWindow1.ClientID %>"); oWindow.Close(); } function showLoadButton() { oLoadButton = document.getElementById('<%=LoadData.ClientID %>'); oLoadButton.style.visibility = "visible"; } function openWin() { var oWnd = GetRadWindow(); oWnd.show(); } function GetRadWindow() { var oWindow = $find("<%= RadWindow1.ClientID %>"); return oWindow; } function EndRequestHandler() { var hdn = document.getElementById('<%= hdn.ClientID %>'); if (hdn.value == "1") { var t = setTimeout("CloseWindow()", 100); hdn.value = ""; } } function load() { Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); } </script> UserControl Code Behind
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Test { public partial class RadWindowTest : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } protected void DropDown1_SelectedIndexChanged(object sender, EventArgs e) { DropDownList DropDown2 = (DropDownList)RadWindow1.ContentContainer.FindControl("DropDown2"); DropDown2.Visible = true; } protected void LoadData_Click(object sender, EventArgs e) { RadWindow1.DestroyOnClose = true; HiddenField hdn = (HiddenField)RadWindow1.ContentContainer.FindControl("hdn"); hdn.Value = "1"; } } }I can remove the UpdateProgress in this example and it would work, but I need the progress to show on the screen. In my more complicated implementation I have a RadGrid inside the RadWindow and it will complain about duplicate controls as well. Also, if I remove my UpdateProgress here "to get it working", when I do a postback the RadWindow closes and I need to reopen it manually. How do I keep it open after the postback? This doesn't happen if I don't have the outter UpdatePanel.
Thanks!
Gilbert
