0

Following the Getting started (Part 2), it shows assigning a defined Model Type to the Sitecore Model.Item.

However, when I open the Model.Item it does not seem to have a Model.Type input.

Through Sitecore Rocks No fields to show

And Sitecore Content Editor No fields to show

And as expected, when attaching the model to the Rendering:

@using Sitecore.Mvc
@model Sitecore_first.Models.Car

<div>
   @Html.Sitecore().Field("Name")
</div>

I get the error:

Inner Exception: Model definition item does not contain a model type name. Item path: /sitecore/layout/Models/Car. Model type field name: Model Type

What could cause the behavior of no Model.Type input field to define the Model class path?


Specifications

  • Sitecore rocks 2.0.39.0
  • Visual studio 2015 Community
  • Sitecore 8.2
3
  • Can you see the Model Type field if you view the item in Sitecore?
    – Richard Seal
    Commented Feb 23, 2017 at 13:50
  • @RichardSeal Sadly not, it also shows the warning: "The current item does not contain any fields."
    – nkmol
    Commented Feb 23, 2017 at 13:51
  • 1
    Sounds like your template is messed up. Check the template setup against a clean install of the same version of Sitecore.
    – Richard Seal
    Commented Feb 23, 2017 at 14:22

2 Answers 2

0

You need to specify a model type for your model. It's the name of the class and name of the assembly. Something like : namespace.yourclass,assembly

Please see attached picture from Content Editor

enter image description here

4
  • Thanks for your comment, but my problem is that the "Data" part does not show. I have also added a screenshot of the "Content Editor, to show this.
    – nkmol
    Commented Feb 23, 2017 at 13:57
  • What sitecore version do you have? can you check if the template has same id like my template id ? {FED... Commented Feb 23, 2017 at 14:02
  • I have version 8.2 of Sitecore (rev 161221) and my template ID looks the same: {FED6A14F-0D05-4E18-B160-17C0588A2005}
    – nkmol
    Commented Feb 23, 2017 at 14:06
  • 1
    looks like somebody delete that field, I verified a Sitecore 8.2 rev 161221 clean solution and it exist. Can you verify recycle bin maybe you will find it there? Commented Feb 23, 2017 at 14:19
0

After installing a second instance, I copied the Model layout fields to my other instance. Apparently, my current Model layout was completely empty.

Acter changing the values to the original values, all worked perfect!

New values

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.