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.
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.
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.
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
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:
Thanks again,
Jim
is working on a reply...