Getting rid of web parts

Discussion in 'ASP .Net Web Controls' started by steve.camsell@gmail.com, Feb 28, 2007.

  1. Guest

    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
     
    , Feb 28, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Hearn
    Replies:
    2
    Views:
    2,773
    David Hearn
    May 25, 2005
  2. Replies:
    3
    Views:
    629
    Keith Thompson
    Mar 31, 2007
  3. Replies:
    1
    Views:
    980
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Apr 12, 2007
  4. kizk
    Replies:
    0
    Views:
    679
Loading...

Share This Page