WebPartManager1.CloseWebPart Error

Discussion in 'ASP .Net Web Controls' started by Jerry C, Jul 13, 2006.

  1. Jerry C

    Jerry C Guest

    I am trying to close a webpart in a WebPartZone. There is a WebPartManager
    and CatalogZone on the page.
    The WebPartZone looks like this

    <ZoneTemplate>
    <uc1:DDEstimate ID="DDEstimate1"
    title="Estimate" runat="server" />
    <uc2:DDStationVendor ID="DDStationVendor1"
    title="Vendor Summary" runat="server" />
    <uc3:DDEstimateLog ID="DDEstimateLog1"
    title="Estimate Status Log" runat="server" />
    <uc5:DDEmailToDownloadAlert
    ID="DDEmailToDownloadAlert1" title="Traffic Manager Alerts" runat="server" />


    </ZoneTemplate>


    I am trying to use the code:
    WebPartManager1.CloseWebPart(DDEmailToDownloadAlert1)
    to close the webpart and getting the error:
    Error 10 Value of type 'ASP.ddemailtodownloadalert_ascx' cannot be converted
    to 'System.Web.UI.WebControls.WebParts.WebPart'.

    Thank you





    --
    Jerry
    Jerry C, Jul 13, 2006
    #1
    1. Advertising

  2. Hi Jerry,

    When using User Control or Server Control as WebPart, they will be wrapped
    with GenericWebPart, which can be referenced by the control's Parent
    property:

    WebPartManager1.CloseWebPart(CType(DDEmailToDownloadAlert1.Parent,
    GenericWebPart))

    Hope this helps. Please feel free to post here if anything is unclear.

    Regards,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Walter Wang [MSFT], Jul 14, 2006
    #2
    1. Advertising

  3. Hi Jerry,

    I am interested in this issue. Would you mind letting me know the result of
    the suggestions? If you need further assistance, feel free to let me know.
    I will be more than happy to be of assistance.

    Have a great day!

    Regards,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Walter Wang [MSFT], Jul 18, 2006
    #3
    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. hfk0
    Replies:
    2
    Views:
    21,638
  2. JavaQueries
    Replies:
    1
    Views:
    3,625
    John C. Bollinger
    Mar 1, 2005
  3. Balaji
    Replies:
    3
    Views:
    10,074
  4. Bishop
    Replies:
    1
    Views:
    760
    Bishop
    Feb 24, 2007
  5. juvi
    Replies:
    3
    Views:
    1,038
    Alexey Smirnov
    Jan 22, 2009
Loading...

Share This Page