Shared Content in Custom Widget
Has anyone looked into rigging their custom widget to have shared content? I have a textbox in my designer, with the editor. But I'd like to be able to pick from shared content like the Generic Content widget.
You should use a custom html field, so you can add a content selector and select the shared content block you want.
I have prepared a sample you can use as a base to build your custom field control. I have attached the control to the reply. Please, change the default control type for the field you want to be using the new control from the default HtmlField to the custom control type
What version is the sharedContentSelector available? I'm getting
Telerik.Sitefinity.Web.UI.TemplateException: A required control was not found in
the template for "~/Controls/CustomHtmlField/CustomHtmlField.ascx". The control
must be assignable from type
"Telerik.Sitefinity.Web.UI.ControlDesign.ContentSelector" and must have ID
The ContentSelector control is available from very old versions, could you please specify your version? Furthermore, the problem is that the control is not found in the template, not that it does not exist as a control. Please, ensure the template is referenced correctly and it is loaded:
Currently on 6.3.5000.
I've double checked those first. If I change the path to the custom control, I get a can not find template file. When I corrected that, it began reporting it can not find the control in the template.
Still does not work. How can I check and verify that the customHtmlField.ascx is loaded? When the application is in debug, I hit the get statement that returns the string in the designers code behind.
I checked and the ContentSelector is available in Sitefinity 6.3 and it is in the same namespace -
Telerik.Sitefinity.Web.UI.ControlDesign, please check you are referencing the same type of control in the designer server code, as well.
For anyone that might look at this thread, note that it is important when creating the custom field you should initially to use the Rich text editor interface, so it can create all default htmlfield properties for the custom field. Then change the control type to be your custom one, inheriting from HtmlField, in the settings. You can change the control type from Advanced settings -> News -> Controls ->NewsBackend -> Views -> Insert/Edit View ->Sections -> CustomFieldsSection. Select your field and change the type to your custom field control one.