Skip to content

How to change the view of a specific field in all Dynamic content MVC widgets

Tihomir Petrov edited this page Feb 11, 2015 · 7 revisions

In different scenarios you may want to change the way a particular field is displayed in all or a single Dynamic content MVC widgets. For a single Dynamic content MVC widget, see How to change the view of a specific field in a single Dynamic content MVC widget. The following article gives you a step-by-step tutorial how to achieve change for all Dynamic content MVC widgets.

PREREQUISITES: You have installed the Feather Nuget package.

1.Go to feather-widgets GitHub repository and navigate to Telerik.Sitefinity.Frontend.DynamicContent -> WidgetTemplates -> Fields -> Templates folder.

2.Copy the content of the DateField.cshtml template

3.Go the SitefinityWebApp project and create new WidgetTemplates folder.

4.Right-click on the WidgetTemplates folder and create new Fields folder.

5.Right-click on the Fields folder and create new Templates folder.

6.Right-click on the Templates folder and create new .cshtml file with name DateField.cshtml.

7.Change the DateTime format in the template as shown below:

@@Model.Item.GetDateTime("@Model.Name", "dddd dd MMMM, yyyy, HH:mm tt")

8.Build the solution.

9.Regenerate the widget templates of the dynamic content MVC widget (you can do that by changing the dynamic content meta type).

As a result the date format of all the Dynamic content widgets that use the DateField will be changed.

Clone this wiki locally