Setting StandardEditorConfiguration Programatically
I want to be able to set the StandardEditorConfiguration property programatically, and it looks like it should be publically accessible (see www.sitefinity.com/.../p_telerik_sitefinity_web_configuration_appearanceconfig_standardeditorconfiguration.html), but when I try to access it in Visual Studio IntelliSense isn't picking it up. Am I missing something here?
Thanks,
Chris Aumiller
Hello Chris,
You can work with the Config manager and get the specific section, and then get/set the values of specific entries there. For example:
var mySection = Config.Get<AppearanceConfig>();
mySection.StandardEditorConfiguration=
"~/test.xml"
;
Config.GetManager().SaveSection(mySection);
Boyan,
I continue to get errors because now VS is not recognizing the AppearanceConfig class. I'm having trouble finding the Class Reference on the website (previously I had a bookmark for www.sitefinity.com/.../introduction.html, but it appears this has moved and I can no longer find it) to look up the correct namespace.
Thanks,
Chris Aumiller
ETA: Thought I might have found it in another issue, but AppearanceSection does not live in Telerik.Sitefinity.Services like SystemConfig does.
Hi,
Please find below the same sample with fully qualified namespaces resolved, I hope this helps you achieve the desired functionality:
var mySection = Telerik.Sitefinity.Configuration.Config.Get<Telerik.Sitefinity.Web.Configuration.AppearanceConfig>();
mySection.StandardEditorConfiguration =
"~/test.xml"
;
Telerik.Sitefinity.Configuration.Config.GetManager().SaveSection(mySection);
Hi Boyan, I'm getting this error when trying implement your solution:
Telerik.Sitefinity.Security.Data.StaticRoot,
Telerik.Sitefinity was not granted ChangeConfigurations in Backend for
principals with IDs 00000000-0000-0000-0000-000000000000
Any idea why this is happening / how to resolve?
Thanks.
Figured it out. In case it helps anyone else, I resolved the error by firing it from the PreApplicationStartMethod.