Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025

 


Article

MVC: Duplicate template is distorted when changing the developer name in the process of creating the duplicate

« Go Back

Information

 
Article Number000108840
EnvironmentProduct: Sitefinity
Version: 8.x, 9.x, 10.x,11.x, 12.x,13.x
OS: All supported OS versions
Database: All supported Microsoft SQL Server versions
Question/Problem Description
When a  template is being duplicated, while setting the properties, the name and developer name of the template is modified.
Once saving the changes and opening the template in edit mode, all the widgets are grayed out and distorted.
In the list view of templates, in the "based on" column, the path points to a non-existent layout file (Ex: Bootstrap4\...\duplicate.cshtml)
Steps to Reproduce
Clarifying Information
The developer name of the template is changed
Error Message
Defect/Enhancement Number
Cause
This is the expected behavior.
For MVC widgets, the developer name is in the format <ResourcePackage>.<LayoutFileName>. For instance, if the developer name of a template is "Bootstrap4.Myduplicate", Sitefinity marks the layout file for the template as  "~\ResourcePackages\Bootstrap4\MVC\Views\Layouts\myduplicate.cshtml" 
When such layout doesn't exist, the template loads all the widgets based upon the controller ID and if the layout file of the original template had some custom styling on the markup, all such customizations are lost and hence, the distorted arrangements of the widgets.
Resolution
Option 1:
Do not change the developer name of the duplicate template.
This way, any changes made on the layout file of the original will reflect on the duplicate template as well.

If the layout files of the templates must be unique and changes made on the layout file shouldn't reflect on the duplicate, proceed wit:

Option2:
Copy the layout file of the original template and paste it in the same location with the name that matches the developer name naming convention.
This way, the layout files are independent and changes made on one layout file do not reflect on the other template.
Workaround
Notes
Attachment 
Last Modified Date5/21/2020 9:35 PM