Questions tagged [glass-mapper]

Questions relating to the Glass.Mapper.Sc ORM framework. More information about the framework is available here: http://www.glass.lu/

Filter by
Sorted by
Tagged with
5 votes
1 answer
85 views

Glassmapper Set outputHeightWidth = true by default

I have a requirement where I need to display the image height and width tags on images. This is also a performance ranking factor for Google Lighthouse. By default, this is set to false in Glassmapper ...
Kode's user avatar
  • 243
0 votes
0 answers
20 views

Glassmapper issue with Sitecore 9.3 causing intermittent 500 error on pages [duplicate]

We are experiencing below issue in few of our CD site urls. We tried below fixes, but no luck. Index rebuild Restarting CD instance Validated the memory and CPU load on CD and Redis which looks fine ...
Christopher Raja's user avatar
2 votes
0 answers
38 views

Glass 5.8 language fallback seems to be working differently to 5.4

We’ve upgraded from Sitecore 9.02 to 10.3 and also GlassMapper to 5.8. We have a strange situation, where in Glass 5.4/Sitecore 9.02 if there is no specific version of an item for a language it would ...
Adam Seabridge's user avatar
0 votes
1 answer
40 views

@Editable does not work right with Multiline Text field; always shows as empty in EE

Using Sitecore 9.3, we have a component that renders multiple fields from the datasource as editable fields, like so: @Editable(model => model.Datasource.Quote) Every field works right except for ...
Erica Stockwell-Alpert's user avatar
1 vote
1 answer
81 views

GlassMapper 5 is returning null properties

I'm trying to get items from Sitecore using GlassMapper 5 and after trying in many ways the properties in my object are always null. Here are my templates. And this is my content tree structure The ...
André Andrade's user avatar
0 votes
2 answers
667 views

A circular reference was detected while serializing an object of type 'System.Globalization.CultureInfo'

I am getting this error when the datsource model have sitecore image field. the below code written in the .cshtml file and the model is binding via Glass mapper. <script> var var1 = @Html.Raw(...
shahul's user avatar
  • 47
0 votes
2 answers
251 views

Replace Custom String from Alt text in Image and Link

In AltText Inserting string which contains HTML char {SomeString} breaks the page.(Error: Input string is not correct format - looks like alt text won't accept html characters) Consider if insert ...
Singh's user avatar
  • 105
0 votes
0 answers
65 views

Sitecore Experience Editor - The source of this Image field points to an item that does not exist

I have a listing component that I want to be editable in EE, so each listing item, which is a new ArticleListElement item mapped from a Glass model with some transformation, also has a field "...
Erica Stockwell-Alpert's user avatar
1 vote
1 answer
104 views

GlassMapper SitecoreParentAttribute is null

After upgrading our solution from Sitecore 9.0.2 -> 10.1.2 we started encountering an issue where the .Parent property on the interface below is intermittently returned as null. It appears that ...
byed's user avatar
  • 21
1 vote
2 answers
266 views

Glass Mapper mapping exception for a LinkList field after upgrade to Sitecore 10.2

We are upgrading our Sitecore instance from Sitecore 8.2 version to Sitecore 10.2 version, ORM used in Sitecore 8.2 is GlassMapper(v4.3.4.197). We have upgraded glass mapper in Sitecore 10.2 via NuGet ...
Karan Kumar's user avatar
1 vote
1 answer
48 views

How to support glass model properties in MVC form validation

I am attempting to build an MVC form that uses ajax to post to a controller action which will return one of 2 partial views depending on the model state, and then perform a partial page update via ...
David Buckell's user avatar
1 vote
0 answers
208 views

How do I correct the Build error after loading Glass.GlassMapper.sc.100 cannot find path Glass.Mapper.Sc.Start.config?

After loading Glass.Mapper.sc.100 and Glass.Mapper.sc.100.mvc (Sitecore version 10) I can no longer build successfully. I am not certain how to resolve this issue. I have loaded and reloaded the Nuget ...
Paul T. Rykiel's user avatar
1 vote
2 answers
206 views

What determines how DataSourceItem is set in Glass Mapper when used with SitecoreService.GetItem?

I am working on some code that was written years ago and I am just trying to understand how it works. On some pages, there is the following code: var context = new SitecoreService(Sitecore....
T H's user avatar
  • 123
0 votes
1 answer
152 views

Glassmapper and Media.RequestExtension Not Working Together

I've got a Rich Text Field and using glass mapper to render the body field [SitecoreField(I_HasPageContentConstants.BodyFieldName, Setting = SitecoreFieldSettings.RichTextRaw)] string Body {get; set;}...
nologo's user avatar
  • 157
0 votes
2 answers
352 views

How to map child items using glass mapper 5.8?

I want to map child items which come from a parent data source and I gave the parent datasource as the datasource for the rendering. This is my Datasource in my rendering This is my list of child ...
Raviraja's user avatar
0 votes
1 answer
185 views

Implement unit test for a sitecore MVC solution with glassmapper

I have the below scenario to implement unit testing on a Sitecore MVC (with glassmapper) integration. We are using a wrapper class to make calls to Glassmapper Sitecore Context methods. Below is one ...
D J's user avatar
  • 385
2 votes
1 answer
283 views

Failed to find ID. Ensure that you have an ID property on your model error in Sitecore Experience editor

I have upgraded my Sitecore instance instance from Sitecore 8.2 to Sitecore 9.3 I am getting below errors in experience editor mode but in normal mode component is not showing because we added error ...
Aditya Gautam's user avatar
0 votes
2 answers
691 views

Context is null in GlassMapperConfigurator

I'm trying to access Sitecore 10.2 model fields using Glass.Mapper.Sc.92 version 5.8, and registered all Glass.Mapper services in GlassMapperConfigurator class. However facing the "Context is ...
Siddhi Kamat's user avatar
0 votes
1 answer
181 views

Javascript link rendered without onclick attribute in preview

When using javascript link the edit mode renders the target script in onClick attribute <a href="#" onclick="javascript:void(0);onclick=javascript:openOverlay('test-overlay',event);...
nari447's user avatar
  • 407
0 votes
1 answer
88 views

Error processing robots.txt

I occasionally see the below error in my logs Error processing robots.txt Exception: Glass.Mapper.MapperExceptioMessage: Service has been disposed, cannot create object My code in Robotservice is as ...
yeshwanth thummala's user avatar
3 votes
2 answers
550 views

SitecoreContext throwing error after Sitecore upgrade

I upgraded my dev instance from Sitecore 8.2 to Sitecore 9.3. My upgrade was successful but I am getting errors when I am trying to access my page. In our solution for getting the current page, we are ...
Aditya Gautam's user avatar
0 votes
1 answer
343 views

Value cannot be null. Parameter name: objectToSwitchTo

I am upgrading Glapp Mapper to V5. I see that the GlassView is deprecated and instead we have to use @Html.Glass(). In V4, my code has something like @Editable(Model, x=>x.BackGroundColor) So I ...
yeshwanth thummala's user avatar
0 votes
1 answer
183 views

Rendering video control with Glass mapper and Experience Editor support

Hi, I am trying to render a video using <video> tag and it expects a url to video file. Looks very straight forward this way but can anyone suggest how I can provide Experience Editor support ...
Parry Brookes's user avatar
0 votes
1 answer
174 views

Implementing Lazy on ContextItem [duplicate]

We are upgrading GlassMapper to V5 and installed Glass.Mapper.Sc.90. I am doing all the changes mentioned in http://www.glass.lu/Mapper/documentation/Upgrade-ToV5.html link one by one. Now, i am ...
yeshwanth thummala's user avatar
0 votes
1 answer
670 views

Glass Mapper 5 lazy loading

We migrated to Sitecore 10.1 and Glass Mapper is upgraded to 5.8.177.0 from 4.3.4.197. I noticed the mapping was not working. I changed the code from var centreHours = glassContext.GetItem<...
Owais Ahmed's user avatar
0 votes
1 answer
103 views

Method not found: 'Void Glass.Mapper.Config.set_EnableLazyLoadingForCachableModels(Boolean)'

We are upgrading GlassMapper to V5 and installed Glass.Mapper.Sc.90. I have done all the changes and mentioned in http://www.glass.lu/Mapper/documentation/Upgrade-ToV5.html link. After the changes, ...
yeshwanth thummala's user avatar
0 votes
0 answers
101 views

TDS mapping returns null for droplink

I have a rendering paramter template which has a droplink field. I have provided the datasource to this field and the datasource items selected will be of another template. We are using TDS and glass ...
Visva Kiruthika Muthuraj's user avatar
2 votes
1 answer
161 views

A/B testing of components using Glass Mapper return "Data source invalid."

I am using Sitecore 9.3 with Glass Mapper 5.8.177 and component A/B testing does not work for me. I set up a simple component that works perfectly fine until I begin creating variants for A/B testing ...
9_9's user avatar
  • 121
0 votes
1 answer
154 views

Glass Mapper GetLayoutItem depreciated method

We are updating GlassMapper from 4 to 5. Since the GlassController is depreciated in new version and we have used GetLayoutItem in many places. Can it be replaced with MvcContext.GetContextItem from ...
Owais Ahmed's user avatar
0 votes
1 answer
474 views

Glass Cast issues after upgrading from Sitecore 8.1 to Sitecore 10.1.2

I am trying to migrate Sitecore items from Sitecore 8.1 to Sitecore 10.1.2. During migration I have got an error as 'Item' does not contain a definition for 'GlassCast' and no accessible extension ...
narasimhulu's user avatar
2 votes
0 answers
100 views

Glass v5 caching and Sitecore security

As part of a Sitecore upgrade I'm also upgrading Glass Mapper to latest version (5.8.177). We were previously on version 4. Our site uses Sitecore OOTB Security and some users do not have read access ...
Jeroen's user avatar
  • 1,214
0 votes
1 answer
347 views

Glassmapper5 returning null for derived type

I am working on Glassmapper 5 and I have baseType and derived type. I need to get derived type(IRich_Text_Section) property values by using basetype(I_PageSection). It is working fine in glassmapper4. ...
Kanniyappan Krishnan's user avatar
1 vote
2 answers
365 views

Issue in applying lazyload for images in @Editable

A Glassmapper is used in our running project and planning to apply lazy loading for all images. For this, I have to implement the renderField Pipeline to apply lazyload functionality to all images. It ...
Manish Dalwadi's user avatar
1 vote
1 answer
250 views

Is there a way to use @Editable (Glass-mapper) and an anonymous model in an html input placeholder?

I have an input box and I would like to be able to have the placeholder text XP editor friendly. <input type="text" class="form-control" placeholder="@Editable(x => x....
JockeyJohnson's user avatar
1 vote
1 answer
539 views

Is there a way to programmatically add attributes to the Glass Mapper Link class

In my code, if the Link field target Item matches the context item I want to add CSS class as active and also add the attribute aria-current=page. Is there a way to add custom attributes to the Glass ...
Renuka's user avatar
  • 185
0 votes
0 answers
42 views

Is there a way to map Sitecore/System/Languages in Sitecore to Sitecore.Globalization.Languages using Glass mapper

I am using TDS and was trying to map the Glass mapper to Sitecore.Globalization.Languages. This requirement is for a Language dropdown with custom names for different regions.
Meghan's user avatar
  • 427
0 votes
1 answer
663 views

Glass Mapper Upgrade to 5.8.177.0. GetDatasource is no longer working after GlassController Obsolete

The following code was working before the upgrade to the latest glass mapper. Since removing the GlassController inheritance the following no longer works. Is there something in the latest version ...
RReilley's user avatar
  • 755
0 votes
1 answer
702 views

Using GlassMapper Models in View Rendering

Sitecore 9.3 I have a view rendering where I was previously using the RenderingModel in the view, () but have switched to using the GlassMapper classes instead (). This works great unless the ...
Michael's user avatar
  • 520
0 votes
2 answers
153 views

How to select an item property in a drop list using Sitecore 8.2 and Glassmapper

it's been a while since I've used Sitecore and I'm struggling with an issue. There is a model which is being autogenerated by TDS and uses Glassmapper for its mapping. [SitecoreType(TemplateId=...
JockeyJohnson's user avatar
1 vote
0 answers
71 views

Rendering SVG as XML using Glass Mapper

I was curious if anyone has a good solution for rendering SVGs using Glass mapper so that the result is XML embedded into the HTML instead of an tag. I know that I can use Editable() with a ...
Alex's user avatar
  • 545
0 votes
1 answer
199 views

Replacement for VersionCountDisabler() in Sitecore 9.3?

We are working on upgrading our solution from Sitecore 8.2 to 9.3 and we came across with the VersionCountdisabler() which is used for the purpose of fallback operation on 8.2 code. Below is the ...
Geetha's user avatar
  • 123
0 votes
1 answer
69 views

Glass mapper does not filter items that have "Hide versions" checked?

Is there a way to make Glass Mapper to filter out items which have "Hide versions" standard field checked?
iusmar's user avatar
  • 239
0 votes
0 answers
172 views

Rendering Parameters values being null after sitecore upgrade

We have upgrade Sitecore solution from 9.1 to 10.11, as part of upgradation we had upgraded Sitecore databases and solution. We have around 80 plus sites and we are using sxa. Let me describe about my ...
Reddy's user avatar
  • 117
0 votes
0 answers
180 views

Glass Mapper: Cast<MyClass>(myItem) returning null, while previously was correctly returning an instance of MyClass

I have the following legacy code wrote by my predecessors: var formSection = SitecoreContextFactory.Default.GetSitecoreContext().Cast<FormSection>(section); FormSection is a simple class with ...
Emanuele Ciriachi's user avatar
0 votes
1 answer
377 views

SitecoreService.GetItem not returning Children/Child Items

The below code is not returning the children's, var TemplateID = Guid.Parse("{51A26CD4-FCB5-4A3C-8720-2D60F625A678}"); var _Options = new GetItemByIdOptions(TemplateID) { ...
gvkarunakar's user avatar
1 vote
1 answer
97 views

Glass mapper A/B testing error - Model item passed as rendering instead of model

I am using Sitecore 9.3 with Glass.Mapper 5.6.163. When I setup simple A/B testing with different content datasource. I get the below error. Inner Exception: The model item passed into the dictionary ...
Medi1480's user avatar
3 votes
1 answer
503 views

Unit Testing with GlassMapper and GetItemByIdOptions

I have some code that retrieves a glass item like this: var root = this.RequestContext.SitecoreService.GetItem<ILookupFolderTemplate>( new GetItemByIdOptions(new Guid("{...
Ethan Schofer's user avatar
1 vote
1 answer
463 views

Glass Mapper and inheritance problem

I am using solution with (the latest for today) Glass Mapper 5.8.173 along with Sitecore 10.0 update 1, where I have upgraded the whole large solution from old Sitecore 8.2 and Glass Mapper 4. I have ...
Martin Miles's user avatar
0 votes
1 answer
172 views

Mock SiteSettingsProvider with Glass Mapper

Does anyone know how I can go about mocking the SiteSettingsProvider in Habitat? Item sitecoreItem= mvcContext.GetContextItem<Item>(); Item settingsItem= settingsProvider.GetSetting(...
gadgetgem's user avatar
1 vote
1 answer
93 views

Component addedon SharedLayout without a version is displayed

Following the below steps, we see an issue in Sitecore v9.3.0 + Glass V5.6.160, compared to Sitecore v9.0.1 + Glass v4.5.0.4: Create a datasource item, version ONLY in EN culture. the fields has ...
user2386411's user avatar

1
2 3 4 5 6