Widget Template from usercontrol in VS project

Posted by Community Admin on 03-Aug-2018 01:27

Widget Template from usercontrol in VS project

All Replies

Posted by Community Admin on 14-Jan-2011 00:00
I saw the video from Gabe about how you can add or edit widget templates to change the html output. In his example though, these were all persisted to the database, which makes for nice demo-ware but we know would not work in real life. In real life we have multiple developers working on a VS solution that is in source control, and we need to be able to publish changes from within VS.
In other words, we would expect the widget templates to be .ascx files living somewhere in our sitefinity project, ie. /Custom/WidgetTemplates/MyCustomImageGallery.ascx

How do we achieve this in Sitefinity 4.0?

Also, I would like to comment that from my experience, end users ie. our clients (from Fortune 100 companies to medium businesses), do not care about editing the HTML, they just want boxes where they can see a pre-defined template and fill in the boxes with their text or images. SF 4 is definitely a good step in that direction.

Best,
Posted by Community Admin on 14-Jan-2011 00:00
Hi James Reategui,

You could map the public control view to use an external template. You could achieve this either through Configurations or through the Property Editor of the public control.
1. Configuration approach is appropriate when you want to change the default template globally:
  • Go to Administration > Settings > Advanced
  • Expand ContentView > Controls > NewsFrontend > Views > NewsFrontendList (in this case you will change the default template for News List)
  • Find TemplatePath property and set the url of your external template
2. Property Editor approach is appropriate when you want to change the template just for a specific control:
  • Go in Edit page
  • Drag News control
  • Click Edit to open control designer
  • Switch to Advanced mode
  • Find ControlDefinition property and click ControlDefinition button
  • Find Views property and click Views button
  • Find NewsFrontendList property and click NewsFrontendList button
  • Set TemplatePath property to point to your custom template
  • Click Save to apply the changes

Hope this helps.

Kind regards,
Pepi
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Posted by Community Admin on 14-Jan-2011 00:00
Thanks, yep, that does it.

Do these settings get persisted to the database or to config files in the project?

I saw the app_data/sitefinity/configuration files so I was wondering what these do and how they relate.
Posted by Community Admin on 17-Jan-2011 00:00
Hello James,

Changes which are made through Property Editor of the control, are saved in the database. While, configuration modifications are persisted in the configuration files located in App_Data/Sitefinity/Configurations folder. Note that control specific settings are treated with the greater priority i.e. if TemplatePath property is set both through Property Editor and Configurations, the database value will be used.

Actually, Settings page provides UI for editing configuration files. They contain all Sitefinity-specific settings, so that the web.config file includes only standard ASP.NET configurations. If a configuration is not set explicitly the default value is used. This means that Sitefinity upgrades do not override client configuration settings.

For more details please refer to the following documentation topic: System Configuration

All the best,
Pepi
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Posted by Community Admin on 25-Mar-2011 00:00
Does this still actually work?  We have been trying to do this for a News widget (both master and details mode) with no success...
Posted by Community Admin on 29-Mar-2011 00:00
Yeah this seems to not be working for me either, it was working perfectly pre SP1 so I suspect that something in the latest service pack has caused this.
Posted by Community Admin on 06-Apr-2011 00:00
Hello Sean,

This is a known issue in the SP and it will be fixed in the upcoming Q1. Please, refer to the following forum thread that provides a workaround for the described problem: SP 1 NewsView LayoutTemplatePath not loading template
We are sorry for the inconvenience caused.

Regards,
Pepi
the Telerik team

This thread is closed