Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Is Max Length on TemplateProperty possible?

Vote:
 

Hi,

Is there a way to specify a max length for a TemplateProperty of type "String<255"?

We would like to limit a couple properties to 80. Is there a way to do this without creating custom properties?

Thanks

-Andrew

 

#39858
Jun 03, 2010 17:01
Vote:
 

I can't think of one. But you don't have to create a full custom property, you can use PropertyControlClassFactory.Instance.RegisterClass to replace the control used to edit strings with the a derived class. However, in that scenario, you'll need to find a way to only limit the properties you want to be limited (and not all string properties). If you are lucky enough to be using EPiServer 6 you should be able to do this using property settings. Since you can't set the property settings for built-in properties you have to leave the default behaviour as-is, but you can add the possibility to, for instance, specify a regex for the input to be tested against.

#39868
Jun 03, 2010 20:10
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.