Hi,
I need to add a 'WebDialog' component on to a webpage everytime a user clicks on a button.
This is the error I'm getting: Cannot unregister UpdatePanel with ID 'dialog0_UpdateContainer' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
Parameter name: updatePanel
I get the error here: PlaceHolder1.Controls.Add(myDialog);
Here is my code behind(c#):
public partial class MultipleWindows : System.Web.UI.Page
{
ArrayList arrayList;
protected void Page_Load(object sender, EventArgs e)
{
arrayList = (ArrayList)Session["dialogs"];
if (arrayList == null)
{
arrayList = new ArrayList();
}
}
public void Button_OnClick(Object sender, System.EventArgs e)
{
//Create new web dialog
C1WebDialog dialog = new C1WebDialog();
dialog.ContentUrl = TextBox1.Text;
//Set the id
int len = arrayList.Count;
dialog.ID = "dialog" + len;
//add it to the collection of Dialogs
arrayList.Add(dialog);
Session["dialogs"] = arrayList;
//loop thru collection of dialogs and paint each one out
for(int index=0; index<arrayList.Count;index++)
{
C1WebDialog myDialog = (C1WebDialog)arrayList[index];
// Add to the page's controls
PlaceHolder1.Controls.Add(myDialog);
// Set open dialog handler
HyperLink HyperLink1 = new HyperLink();
HyperLink1.NavigateUrl = String.Format("javascript:openWindow($get(\"{0}\") );", myDialog.ClientID);
}
}
}
Here is page code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MultipleWindows.aspx.cs" Inherits="MultipleWindows" %>
<%@ Register Assembly="C1.Web.C1WebDialog.2" Namespace="C1.Web.C1WebDialog" TagPrefix="c1d" %>
<html>
<head runat="server">
<script type="text/javascript">
var form_dialog;
function openWindow(dialog)
{
form_dialog = dialog.control;
dialog.control.show();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
<asp:TextBox ID="TextBox1" runat="server" Text="http://www.yahoo.com"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button_OnClick"/>
</div>
</form>
</body>
</html>
Any ideas anyone?
Thanks