Monday, March 26, 2012

Design time problem when put my control in UpdatePanel

I put my viewer control into an UpdatePanel control, then use smart tag to create a source control and bind to the source control by specifying the source control ID. I use IComponentChangeService to add and remove the event handlers for events that add, change, remove or rename components. I can see the source control is Added, and my viewer control is Updated. But then I find all controls in UpdatePanel are Removed, and Added again. At last the UpdatePanel control is Updated. I expect the UpdatePanel should not remove and add again all its controls. Do you know why? And what's wrong with my control? Thanks!

Here is the call stack when its controls are removed:

System.Design.dll!System.ComponentModel.Design.DesignerHost.RemoveFromContainerPreProcess(System.ComponentModel.IComponent component = {CrystalDecisions.Web.CrystalReportSource}, System.ComponentModel.IContainer container) + 0x88 bytes
System.Design.dll!System.ComponentModel.Design.DesignerHost.Remove(System.ComponentModel.IComponent component = {CrystalDecisions.Web.CrystalReportSource}) + 0x11 bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.IntrinsicElementDesigner.Destroy() + 0x57 bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.ElementDesigner.Destroy() + 0x25 bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.IntrinsicElementDesigner.Microsoft.Web.Design.Interop.IWebIntrinsicElementDesigner.Destroy() + 0x5 bytes
[Native to Managed Transition]
[Managed to Native Transition]
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.ElementDesigner.UpdateView(bool fSaveRegions) + 0x4be bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.ElementDesigner.System.Web.UI.Design.IControlDesignerView.Update() + 0xa bytes
System.Design.dll!System.Web.UI.Design.ControlDesigner.UpdateDesignTimeHtml() + 0x38 bytes
System.Design.dll!System.Web.UI.Design.ControlDesigner.OnComponentChanged(object sender, System.ComponentModel.Design.ComponentChangedEventArgs ce) + 0x559 bytes
> System.Web.Extensions.Design.dll!System.Web.UI.Design.UpdatePanelDesigner.OnComponentChanged(object sender, System.ComponentModel.Design.ComponentChangedEventArgs ce) + 0x13 bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.DocumentDesigner.OnComponentChanged(object sender, System.ComponentModel.Design.ComponentChangedEventArgs ce = {System.ComponentModel.Design.ComponentChangedEventArgs}) + 0x70 bytes
[Native to Managed Transition]
[Managed to Native Transition]
System.Design.dll!System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IComponentChangeService.OnComponentChanged(object component, System.ComponentModel.MemberDescriptor member, object oldValue, object newValue) + 0x76 bytes
System.dll!System.ComponentModel.ReflectPropertyDescriptor.SetValue(object component = {System.Web.UI.UpdatePanel}, object value = {System.Web.UI.FileLevelPageControlBuilder}) + 0x196 bytes
System.Web.Extensions.Design.dll!System.Web.UI.Design.UpdatePanelDesigner.SetEditableDesignerRegionContent(System.Web.UI.Design.EditableDesignerRegion region, string content) + 0x6e bytes
System.Design.dll!System.Web.UI.Design.EditableDesignerRegion.Content.set(string value) + 0x11 bytes
Microsoft.Web.Design.Client.dll!Microsoft.Web.Design.ElementDesigner.Microsoft.Web.Design.Interop.IWebElementDesigner.SetEditableRegionContent(int indexRegion, string content) + 0x52 bytes
[Native to Managed Transition]

Does anyone know in what kind of conditions there will be a complete remove all and re-add all controls of an UpdatePanel?

And why Microsoft.Web.Design.Interop.IWebIntrinsicElementDesigner.Destroy() is called in the process of UpdatePanelDesigner.OnComponentChanged?

Thanks!

No comments:

Post a Comment