Skip to main content
added 126 characters in body
Source Link

Based on your last question and this question I am adding some details-

In Glass mapper, two types of Models are being in use called - Template Models and Rendering Models - See more here - http://glass.lu/Blog/TemplateVsRendering

It seems you are using Rendering Models, these are models that are designed to contain just the properties required by a rendering. Rendering Models still have some limitations, one of them is that it is difficult to link properties to the fields in Sitecore because the field name or display name in Sitecore name may differ and may contains space in it. 

I will suggest you, to create a list of field name constants and then use attribute or fluent configuration to link these names to the properties on your view models -

[SitecoreField("Your Field Name")]
public string Destination_Name { get; set; }

or

public class SingleStack
    {
        [SitecoreField(Templates._SingleStack.Fields.Logo)]
    public Glass.Mapper.Sc.Fields.Image Logo { get; set; }
    
    [SitecoreField(Templates._SingleStack.Fields.AttractionName)]
    public string Attraction_Name { get; set; }
    
     [SitecoreField(Templates._SingleStack.Fields.DestinationName)]
    public string Destination_Name { get; set; }
    
    [SitecoreField(Templates._SingleStack.Fields.IsAtttraction)]
    public bool Is_Atttraction { get; set; }

    [SitecoreId]
    public Guid ID { get; set; }
   
   [SitecoreField(Templates._SingleStack.Fields.Explore_More_Link)]
   public Glass.Mapper.Sc.Fields.Link ExploreMoreLink { get; set; }    

    }

Where SitecoreField(Templates._SingleStack.Fields will have all your field names, make sure your field name is correct.

Based on your last question and this question I am adding some details-

In Glass mapper, two types of Models are being in use called - Template Models and Rendering Models - See more here - http://glass.lu/Blog/TemplateVsRendering

It seems you are using Rendering Models, these are models that are designed to contain just the properties required by a rendering. Rendering Models still have some limitations one of them is that it is difficult to link properties to the fields in Sitecore because the field name or display name in Sitecore name may differ. I will suggest you, to create a list of field name constants and then use attribute or fluent configuration to link these names to the properties on your view models -

public class SingleStack
    {
        [SitecoreField(Templates._SingleStack.Fields.Logo)]
    public Glass.Mapper.Sc.Fields.Image Logo { get; set; }
    
    [SitecoreField(Templates._SingleStack.Fields.AttractionName)]
    public string Attraction_Name { get; set; }
    
     [SitecoreField(Templates._SingleStack.Fields.DestinationName)]
    public string Destination_Name { get; set; }
    
    [SitecoreField(Templates._SingleStack.Fields.IsAtttraction)]
    public bool Is_Atttraction { get; set; }

    [SitecoreId]
    public Guid ID { get; set; }
   
   [SitecoreField(Templates._SingleStack.Fields.Explore_More_Link)]
   public Glass.Mapper.Sc.Fields.Link ExploreMoreLink { get; set; }    

    }

Where SitecoreField(Templates._SingleStack.Fields will have all your field names, make sure your field name is correct.

Based on your last question and this question I am adding some details-

In Glass mapper, two types of Models are being in use called - Template Models and Rendering Models - See more here - http://glass.lu/Blog/TemplateVsRendering

It seems you are using Rendering Models, these are models that are designed to contain just the properties required by a rendering. Rendering Models have some limitations, one of them is that it is difficult to link properties to the fields in Sitecore because the field name or display name in Sitecore name may differ and may contains space in it. 

I will suggest you, to create a list of field name constants and then use attribute or fluent configuration to link these names to the properties on your view models -

[SitecoreField("Your Field Name")]
public string Destination_Name { get; set; }

or

public class SingleStack
    {
        [SitecoreField(Templates._SingleStack.Fields.Logo)]
    public Glass.Mapper.Sc.Fields.Image Logo { get; set; }
    
    [SitecoreField(Templates._SingleStack.Fields.AttractionName)]
    public string Attraction_Name { get; set; }
    
     [SitecoreField(Templates._SingleStack.Fields.DestinationName)]
    public string Destination_Name { get; set; }
    
    [SitecoreField(Templates._SingleStack.Fields.IsAtttraction)]
    public bool Is_Atttraction { get; set; }

    [SitecoreId]
    public Guid ID { get; set; }
   
   [SitecoreField(Templates._SingleStack.Fields.Explore_More_Link)]
   public Glass.Mapper.Sc.Fields.Link ExploreMoreLink { get; set; }    

    }

Where SitecoreField(Templates._SingleStack.Fields will have all your field names, make sure your field name is correct.

Source Link

Based on your last question and this question I am adding some details-

In Glass mapper, two types of Models are being in use called - Template Models and Rendering Models - See more here - http://glass.lu/Blog/TemplateVsRendering

It seems you are using Rendering Models, these are models that are designed to contain just the properties required by a rendering. Rendering Models still have some limitations one of them is that it is difficult to link properties to the fields in Sitecore because the field name or display name in Sitecore name may differ. I will suggest you, to create a list of field name constants and then use attribute or fluent configuration to link these names to the properties on your view models -

public class SingleStack
    {
        [SitecoreField(Templates._SingleStack.Fields.Logo)]
    public Glass.Mapper.Sc.Fields.Image Logo { get; set; }
    
    [SitecoreField(Templates._SingleStack.Fields.AttractionName)]
    public string Attraction_Name { get; set; }
    
     [SitecoreField(Templates._SingleStack.Fields.DestinationName)]
    public string Destination_Name { get; set; }
    
    [SitecoreField(Templates._SingleStack.Fields.IsAtttraction)]
    public bool Is_Atttraction { get; set; }

    [SitecoreId]
    public Guid ID { get; set; }
   
   [SitecoreField(Templates._SingleStack.Fields.Explore_More_Link)]
   public Glass.Mapper.Sc.Fields.Link ExploreMoreLink { get; set; }    

    }

Where SitecoreField(Templates._SingleStack.Fields will have all your field names, make sure your field name is correct.