Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon Osborne 108 posts 150 karma points
    Dec 29, 2011 @ 23:16
    Simon Osborne
    0

    Create a speechbubble from a custom class

    I am trying to trigger a speechbubble in the Umbraco Admin tools from a custom class.

    When I use the following:

    umbraco.BasePages.BasePage.Current.ClientTools.ShowSpeechBubble(umbraco.BasePages.BasePage.speechBubbleIcon.success, "Title Text", "Message Text")

    I get:

    Object reference not set to an instance of an object

    I a guessing it's because as it is a class rather than the partial class associated with a user control or page it cannot see the current base page.

    How can this be achieved?

     

    Thanks,

    Simon

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 30, 2011 @ 14:09
    Tom Fulton
    0

    Hi,

    I'm not sure you'll be able to do this without a reference to the page.  What type of class is this being called from?

    -Tom

  • Simon Osborne 108 posts 150 karma points
    Jan 02, 2012 @ 01:01
    Simon Osborne
    0

    Hi Tom,

    its a compiled public class I have written for a custom section.

    Have also noted that it produces the same error in a compile user control that is loaded into the tabpage. How would I reference the current basepage, or convert the system.web.ui.page into a basepage?

    I was trying the following as an alternative:

    Dim pg As System.Web.UI.Page = HttpContext.Current.Handler
    Dim bPage As BasePage = CType(pg, BasePage)
    bPage.ClientTools.ShowSpeechBubble(umbraco.BasePages.BasePage.speechBubbleIcon.success, "Title Text", "Message Text"

    but I get the following error:

     

    Unable to cast object of type 'ASP.umbraco_control2k_order_aspx' to type 'umbraco.BasePages.BasePage'.

     

     

     

     

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jan 10, 2012 @ 15:34
    Tom Fulton
    0

    Hi,

    I'm not sure how to convert the Page into a BasePage.  Maybe it has something to do with your custom page - is it inheriting from an umbracoPage?  Maybe you can try casting to umbracoPage instead of BasePage.

    However, the ShowSpeechBubble is just a wrapper for a javascript method, so if you have a reference to the page perhaps you can just inject some javascript:

    UmbClientMgr.mainWindow().UmbSpeechBubble.ShowMessage('success', 'title', 'message');

    -Tom

Please Sign in or register to post replies

Write your reply to:

Draft