Getting rid of web parts

S

steve.camsell

Hello there,

I have a problem which has got me really scratching my head trying to
figure out what is going on.

I have a page enabled for web parts where users can add, remove and
edit web parts that I have constructed. The problem lies in removing
web controls from the page. When the user clicks on the Close verb for
a web part, the control is removed and I now have a blank page -
everything appears on the surface to be OK. However, if I put a
breakpoint on my web part control in OnInit the method still fires
even though the control is no longer present on the page. The page is
completely empty, yet the control's code is still firing. If I add a
second control then remove it using the Close verb, the OnInit fires
twice on my empty page!

If I switch the trace on for the page and look at the Control Tree, I
can see that my control is present under the web part manager:

ctl00$mainContent
-ctl00$mainContent$ctl00
-- ctl00$mainContent$WebPartManager1
---ctl00$mainContent$WebPartManager1$wp182617350GenericWebPart
----ctl00$mainContent$WebPartManager1$wp182617350GenericWebPart
$wp66237375usercontrols_kpistatussummary_ascx

Can anyone shed any light as to what is happening here? When the user
closes a control I want it to completely vanish from the page until
such time as they add another instance from the catalog. Why does my
control's code still fire when it is no longer present/visible on the
page?

Potentially useful facts:
I have my own PersonalizationProvider class but this is calling to the
standard SQL server tables and sprocs.
I have subclassed the WebPartPartManager but have only added a couple
of custom properties.
I have sub-classed the WebPartZone in order to control which verbs are
displayed etc
Other than this problem everything else seems to work just fine.

Many thanks in advance for any insight into what is going on here.

Steve Camsell
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top