popup pn = new popup();
pn.Title = "New Message";
pn.Message = "New Study Received";
pn.ColorStyle = popupColorStyle.Green;
UpdatePanel1.Controls.Add(pn);
popup is my custom control which shows a popup and UpdatePanel1 is a ajax control. I want to show the popup without re-loading the full page . The last line throws me an error as “The Controls property of UpdatePanel with ID ‘UpdatePanel1’ cannot be modified directly. To change the contents of the UpdatePanel modify the child controls of the ContentTemplateContainer property.” I am using ASP.NET 3.5 … Can anyone know the issue
The error message is telling you exactly what is wrong and how to fix it. Rather than adding the control to Controls, you need to add it to ContentTemplateContainer.Controls, i.e.
From the MSDN documentation: