6

This will work for the basic params; @using Sitecore.Resources.Media <div style="background-image:url(@HashingUtils.ProtectAssetUrl(string.Format("{0}?{1}", Model.Logo.Src, new MediaUrlOptions { MaxWidth = 200 })))">Hello</div>


5

You should use now either GetItemByIdOptions or GetItemByPathOptions (or other options) and pass language there, e.g.: var options = new GetItemByIdOptions(guid) { Language = language }; var item = sitecoreService.GetItem<IAvailableCountries>(options); Read more here: https://blogs.perficient.com/2018/10/29/glass-mapper-part-2-of-2-what-is-new-and-...


3

You want to change your ID property to type Guid. Also, you can add the attribute SitecoreId to the property. [SitecoreId] public Guid ID { get; set; } This should allow Glass to map to your class properly. You can see a really basic example of this on the Glass Mapper website: http://glass.lu/Mapper


3

Update your model to have the type of your TreelistEx field be an IEnumerable<Glass.Mapper.Sc.Fields.Image> instead of using IDs. Something like: using System.Collections.Generic; using Glass.Mapper.Sc.Fields; [SitecoreType(TemplateId = "{TEMPLATEID}")] public class ImageGroup { [SitecoreField(FieldId = "{FIELDID}")] public ...


3

You can create a new child item template lets say ChildImage template which will contain the Image field. Parent template will have TreeListEx field which will allow to select child items (ChildImage). Parent Datasource ChildImage Class [SitecoreType(TemplateId=I_ImageListConstants.TemplateIdString )] public partial interface I_ImageList : IGlassBase { ...


2

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 ...


2

I know about 3 reasons that could be the issue: Check if you have maybe double .config files for Glass Mapper. If you had already some configs in your project and then you installed Glass from nuget, it will add its config again and you may see exceptions like that. You have old versions of Glass mapper dll files in your bin folder. Check all of them if ...


1

Please change requestValidationMode="4.0" to requestValidationMode="4.5" in web.config file. It was working for me.


1

The easiest way to do what you want would be to add the raw Sitecore item as a property to your Glass model and then for that specific field, use the Sitecore item's property. This would make that property read-only. public class YourModel { [SitecoreItem] public virtual Item Item { get; set; } public IEnumerable<string> CampaignIds => ...


1

__Tracking is an advance field type for analytics. It stores the value in it as XML format. You can try by assigning the profile card on an item and see it's raw value. when you run the code - var pageItem = Sitecore.Context.Item; var trackingField = new TrackingField(pageItem.Fields["__Tracking"]); basically, it is initializing and invoking ...


1

In order to use these new services, you have to first inject them with the Sitecore dependency injection container. Maybe that is the reason why you always get null results. There is a good blog post about it: https://www.coreysmith.co/glass-mapper-5-dependency-injection/ Also, I have written my simple solution if you are using Helix: https://...


1

There is no such a thing like "correct order or items returned by Sitecore query". Only children of an item are sorted. Sort order information is stored on the parent item and if you use SitecoreChildren with Glass, you will get them in the order from Sitecore Content Tree, e.g.: [SitecoreChildren(IsLazy = false)] public virtual IEnumerable<Child> ...


1

We have experienced something like that once on production environment, after some period of time servers were running out of memory. With help with Sitecore support, they pointed out we have a lot of GlassMapper objects, coming from casting items into GlassMapper objects. We have created custom extension method: public static T GlassCast<T>(this ...


1

For others who are still struggling, here is an official site link from glass mapper, I found this to be more clear than other answers. http://www.glass.lu/mapper/documentation/Upgrade-ToV5


Only top voted, non community-wiki answers of a minimum length are eligible