Copied to clipboard

Flag this post as spam?

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


  • James Hildeman 92 posts 88 karma points
    Apr 27, 2010 @ 22:18
    James Hildeman
    0

    How to determine if datatype is in designmode?

    I am building a datatype that is architected as a User Control.  The control has a validator on it (implements IValidator).  I'm using this uc/datatype on a "data" tab for a doc2form field (i.e. a field for a front-end form) so it doesn't really need to be entered in the Umbraco backend.  My problem is that validation is triggered when you're in the Umbraco backend saving the form and I want to avoid that. 

    QUESTION:  Is there anyway for a user control to determine when it is being run from the Umbraco workarea (i.e. design mode)?  If I know I'm in design mode, then I can disable the validation. 

  • Richard Soeteman 3875 posts 12037 karma points MVP
    Apr 27, 2010 @ 22:41
    Richard Soeteman
    0

    Hi,

    Not a real solution but you can check the base class of the Page.If you are in Umbraco the base page should be UmbracoEnsuredPage.Snippet:

    if(Page is UmbracoEnsuredPage){

    //I'm in Umbraco

    }

    Hope it helps you,

    Richard

  • James Hildeman 92 posts 88 karma points
    May 05, 2010 @ 20:40
    James Hildeman
    0

    You rock!  This worked like a champ.  I just implemented this logic and now things are working great on the public side of my site and on the back end.  That's so clean.  I don't know why I didn't think of it.

    Here is the fully syntactically correct vb.net version for others to reference:

                If (TypeOf (Page) Is umbraco.BasePages.UmbracoEnsuredPage) Then
                    IsFound = True
                End If
    I also needed to reference "umbraco.businesslogic.dll" in my project.

    Thanks again,

    Jim

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies