This is a migrated thread and some comments may be shown as answers.

how to hide placeholder control on App Exit

0 Answers 25 Views
HTMLPlaceHolder
This is a migrated thread and some comments may be shown as answers.
Jeff Moeller
Top achievements
Rank 1
Jeff Moeller asked on 03 Jun 2011, 05:39 PM
We are hosting multiple silverlight applications in the same ASP page and using javascript to swap silverlight applications (swap the contents of a div). When we swap out an application that was hosting a RadHtmlPlaceholder control, the application exits, but any RadHtmlPlaceholder iframe elements remained visible on top of the newly swapped-in application.

OnUnload() does not seem to be called when exiting the silverlight application in this manner, and we suspect this is the root of this issue. Setting IsVisible to Collapsed and calling UpdateLayout() did not seem to work from Application_Exit(). However, we were able to come up with a solution...

We implemented logic in Application_Exit() to search the root visual's descendants for all RadHtmlPlaceholder controls. We then removed each child HtmlElement in the RadHtmlPlaceholder control's HtmlPresenter as follows:
var htmlChildren = htmlPlaceholder.HtmlPresenter.Children;
foreach (var child in htmlChildren) 
     htmlPlaceholder.HtmlPresenter.RemoveChild(child as HtmlElement);

Hopefully this solution will help someone else...

No answers yet. Maybe you can help?

Tags
HTMLPlaceHolder
Asked by
Jeff Moeller
Top achievements
Rank 1
Share this question
or