Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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/

1
vote
0answers
14 views

Can I have a field that is populated with values from my Lucene index excluesively?

Sitecore 8.1, Lucene index. I have a (Glass) field marked with [SitecoreIgnore] that I would like to be populated with values from the index. More specifically, the index has a number of strings ...
1
vote
1answer
20 views

The type is not supported by SitecoreIdMapper

I'm trying to get children of a specific template under an item using: [SitecoreQuery("./*[@@templateid='{051E9E07-F488-41EA-A87E-0A92EA32B86B}']", IsRelative = true)] public virtual ...
1
vote
1answer
26 views

Experience Editor edit mode doesn't work if “website” site node is not present [duplicate]

We are using a custom patch into Sitecore.config to define our own site node. It has pretty much the exact same settings as the default "website" site node except for the name, hostname and rootpath. ...
1
vote
1answer
31 views

Is there a way to change icon when using GlassMapper BeginEditFrame?

I need to edit complex sitecore fields in Experience Editor and I am using Glass's BeginEditFrames for that as it only requires change in code. I am using <%using (BeginEditFrame(Model, "Edit ...
2
votes
0answers
21 views

Using Glass (v5) to query a bucket for a certain template containing value in name

I have had a to get child items in a tree where their name contains a value. This was working until I updated the node (and its templates) to be a bucket. Now I can't get the query to return anything. ...
0
votes
0answers
39 views

How Do I render an image field from solr index via glass mapper?

I have a custom solr index in sitecore 9. I am indexing and storing all my image fields. Following are my glass models for search result items public class BaseSearchResultItem : SearchResultItem { ...
2
votes
1answer
20 views

Using Glass().Editable() in a property tag causes unexpected behavior

Experiencing an odd issue when using @Html.Glass().Editable() inside the value property of an input element. My markup is: <input type="submit" name="search" value="@Html.Glass().Editable(Model, x ...
1
vote
1answer
37 views

Accessing IMvcContext/ISitecoreService in a view rendering

This is using Sitecore 9.0.2 and Glass 5.1.10. I'm trying to figure out the best way to access the IMvcContext (or ISitecoreService) in a view rendering. Using controller rendering is very ...
2
votes
1answer
81 views

Glass always returns null

I am running into an issue for a site we are upgrading from 8.1 to 9.0.1. In the process of refactoring and updating the code base, we have upgraded Glass from v3 to v4.5. After doing so, every Glass ...
0
votes
1answer
53 views

Glass RenderLink not rendering right media url

Sitecore verison - 9.0.2 Glass version - 5.0.6.0 We are trying to use Glass @RenderLink to render a pdf media item, it's generating anchor tag with below path /sitecore/media-library/site-content/...
0
votes
1answer
45 views

Glass Error opening Experience Editor (ObjectToSwitchTo)

I'm using @Html.Glass().Editable(Model, x => x.MyProperty) for some of our single-text / rich text fields. When I load the site with this code in the view everything looks fine. However, when I ...
0
votes
0answers
16 views

Dynamic values change in project when published, rebuilt or website restarted

I have a weird problem that has popped up in a project. We have created a function that allows content builders to use a dropdown to select a value in the content editor, which in turn uses a ...
1
vote
2answers
55 views

Occasional error on glass 4.5.0.4 on sitecore 9 “Page editing error. Could not find property”

Getting occasional error on glass 4.5.0.4 on Sitecore 9. "Page editing error. Could not find property **** on type ****BaseItemModel at Glass.Mapper.Utilities.GetGlassProperty.... at Glass.Mapper....
6
votes
2answers
228 views

Getting value out of Sitecore DropLink with GlassMapper

I have been working on a problem for a bit now, and coming back to it again. I have most of it taken care of, thanks to previously posted questions Sitecore 7.2 parsing a droplink field in viewmodel, ...
0
votes
1answer
160 views

Glass Mapper BeginRenderLink produces link to www.google.com [closed]

Sitecore 8.1 Revision 160519 Glass Mapper 4.5.0.4 I have a link field in Sitecore set to an internal link. If I just render the link on a page (link.GetUrl()) it produces the correct relative Url. ...
0
votes
0answers
56 views

Sitecore 7.2 parsing a droplink field in viewmodel [duplicate]

I am trying to use a droplink in our events section to allow users to select a list of events. I setup the field as a droplink, with the label as the event name, and the event guid as the value. The ...
1
vote
2answers
153 views

How to read PDF files from multilist using glass mapper?

I have uploaded all PDF files under media library. In one of my template, I added multilist with datasource to the pdf files which are created under media Library. Now in my code,I have to read the ...
2
votes
0answers
35 views

Adding extra empty lines in GlassData.cs through TDS

For some reason a lots of empty lines are added when TDS regenerate GlassData.cs. This makes bitbucket diff hard and a lot longer to read, because the previous version didn't have all these blank ...
0
votes
0answers
55 views

Is there a way to use complex types as SitecoreFields?

Is there a way to use complex types to duplicate property declarations in a Glass model? For example, imagine a page with 5 images on it and each image needs a URL and alt text: [SitecoreType(...
0
votes
0answers
27 views

Glass Mapper returning null for pages that have modules that have sitecore security “Require login” set

We are in process of upgrading to Glass Mapper V4 and some of the pages have stopped working. These pages have modules that have sitecore security "Require login" set. These pages used to work fine ...
1
vote
1answer
179 views

Language fallback for Non-Shared fields are not working with Glass mapper and Sitecore 9?

I have a site configured with an item and field language fallback. We are using glassmapper as an ORM. We have used VersionCountDisabler in the code and global.asax level. Settings: ...
1
vote
1answer
35 views

New Template fields => is GlassData.cs re-generated automatically, no manual action needed?

I've added 4 new fields under /Sitecore/Templates. Just to confirm, are my following assumptions correct? I feel I'm closing in from experiments alone, but among so many things to know and read about,...
0
votes
0answers
36 views

Glass SitecoreQuery Property null

I have following SitecoreQuery property in a class called Product.cs [SitecoreQuery("/sitecore/content/Site/**[@@templateid='{0F03D8C4-D079-4726-8C06-CD9093ED576B}']", IsRelative = false, IsLazy = ...
0
votes
1answer
105 views

Is it possible to display field name in View(cshtml) using glass mapper

I am trying to display field name using Glass Mapper in view rendering in following format: FieldName - FieldValue FieldName - FieldValue Ex: Country - USA City - New York I ...
0
votes
1answer
132 views

After upgrade to Sitecore 8.2 and GlassMapper 4.3.4.197 “Cannot create an abstract class.” error appeared [closed]

After performing an upgrade from 8.1 to Sitecore 8.2 and GlassMapper 4.3.4.197 (from 4.0.3) I faced the following error described below. All the GlassMapper.Sc.Custom files remain the same and it ...
0
votes
1answer
281 views

Glass mapper BeginRenderLink stripping query string parameter that is a Url with ga parameters

I'm using glass mapper BeginRenderLink to output some links: @using (BeginRenderLink(link, n => n.Destination, isEditable: true)) { @RenderImage(link, lnk => lnk.LinkIcon, isEditable: true, ...
3
votes
1answer
430 views

Map Sitecore “Name Value List” field to NameValue collection

Im trying to map Sitecore "Name Value List" field to NameValueCollection using below code which is not working. [SitecoreType(AutoMap = true)] public interface IManifest { string Title { get; ...
0
votes
0answers
105 views

How to get children of GlassBase Item which have a version in the context language and language fallback is enabled

Using glass mapper, how to get children of an item which have a version in context language even when language fallback is enabled. We are using Language Fallback Module from the Sitecore Marketplace.
0
votes
0answers
118 views

Inconsistent “Service has been disposed” error from Glass.Mapper

Our Sitecore setup had been running just fine for more than a year but during the Christmas break at the end of last year we suddenly had one of our CD servers go down with the following error being ...
0
votes
1answer
372 views

Casting of SitecoreContext vs SitecoreService Which is fast?

In my project I am using following code to cast items. After some time, I came to know there are two way we can cast using SitecoreService and using glass mapper Sitecore Context. results.Select(p =...
0
votes
1answer
116 views

Mapping JSON object to Glass object not working - Ajax POST

I have a custom form and wanted to create complex Sitecore items. I am using TDS auto-generated class with GlassMapper. I am passing Glass object from controller to view, which then serialized to ...
0
votes
1answer
365 views

Get parent item and it's all child item from solr searchresultItem

I have a requirement that needs to get particular item along with all child item or some of the child item using template id from solr searchresultitem. Can anyone help how to achieve this?
0
votes
1answer
53 views

“Type exists in multiple assemblies” with Glass and fluent config

I'm trying to set up fluent configuration for my project; it's non-Helix and the models and maps right now are in the web project. In the GlassMapperScCustom.cs, I've added this script (that's similar ...
0
votes
0answers
228 views

Generating same GlassMapper model classes without using TDS

In our project, we are using TDS to sync and serialize Sitecore items. We are also using TDS to generate GlassMapper model classes for all Sitecore Templates. But now, we are planning to use Unicorn ...
5
votes
1answer
778 views

How to get Descendants of a Sitecore item using Glass mapper?

Is there any direct approach to get descendants(child items and sub child items) of a Sitecore item in Glassmapper model. I know [SitecoreChildren] can be used in GlassMapper model to get Child items....
10
votes
1answer
991 views

What are the options for Glass Mapper model attributes?

I have looked through the documentation and tutorials on the Glass Mapper site, but I can't find a list of the different attributes that are available and what they do.
0
votes
1answer
131 views

Error when casting item to Complextype with Glass

Im having a problem with Glass Mapper, mapping/casting an item to a custom model. The Model with the complextype property (snippet): [SitecoreType(TemplateId = Templates.IDString, AutoMap = true)] ...
0
votes
3answers
325 views

Getting “Message: Service has been disposed, cannot create object” with Glass.Mapper

I'm using Glass.Mapper v4.5.0.4 and Sitecore 8.2 (rev. 170407). I'm doing an import into Sitecore and am using the SitecoreService.Save(T target) method for creating and saving items. I have the ...
0
votes
1answer
291 views

How is the anchor tag created when editing link with Glass Mapper?

I'm using Sitecore MVC with Glass Mapper. When I'm creating a component with a link field, I just add @Editable(myLink, x=> x.myLinkField) After setting the links properly on ...
0
votes
1answer
61 views

Locating “@this.HomePage.BulkPurchasesPage.Url” in the Sitecore tree

In a .cshtml View I've got: <a href="@this.HomePage.BulkPurchasesPage.Url"> I haven't been able to locate this so far. I don't see it on neither the Template __StandardValues nor on the ...
5
votes
2answers
392 views

Glass Mapper: DateTime format in experience editor

So I've wanted to change the default format of the date time field in the experience editor. I've had a look and most people suggest @Editable(item, x => x.Start_Date, x=>x.Start_Date....
1
vote
0answers
180 views

Is there any chance to build SXA custom component using Glass mapper?

It may be a very basic question as I'm beginner in sitecore SXA. Is there any possible way to build the SXA custom component using Glass Mapper? Thanks
2
votes
1answer
621 views

Glass Mapper - How do I configure an image field with Url Options?

If I were mapping a Link type field, I can override the default URL options like this. [SitecoreField(UrlOptions = SitecoreInfoUrlOptions.AlwaysIncludeServerUrl)] public Link ThisIsALink { get; set; }...
1
vote
1answer
183 views

Glass Mapper not caching a SitecoreContext.GetItem<IThing> request

Base class for a service providing data for an API controller on a 8.2 update-4 instance. Code's context is the web database and it's a simple case of using content search to find an item based on a ...
1
vote
1answer
171 views

Glass Mapper doesn't return null?

var model = GetContextItem<ICmsModel>(); I noticed that glass doesn't return null if ICmsModel is not derived from the Context Item... In this example, I'd expect glass to try and map it, but ...
1
vote
1answer
289 views

Glass.Mapper.Sc.SitecoreService.Create fails [closed]

We upgraded from sitecore 7.2 to 8.2 and glass mapper from 4.0.9.60 to 4.4.0.199/4.4.1.331-beta. After upgrade, new SitecoreService("master").Create(folderItem, name, language) is failing with below ...
1
vote
1answer
266 views

Glass Mapper generates an Empty Link Text for General Link Field that has a Media Link with an Empty Link Description

I've have a General Link field. Using 'Insert media link' I have it pointed to a Media Item under the Media Library. When the page is rendered in the Experience Editor Mode, Link correctly display ...
1
vote
2answers
179 views

Adding Custom (non sitecore field) property or method to Glass Mapper Class Returns Null

I've got an issue with extending the partial class from a TDS generated Template for glass mapper. Basically, I want to add a method to the underlying class to say have a custom string based on a ...
3
votes
1answer
559 views

Glass BeginRenderLink not showing text node

<a href="https://google.com" class="link" ></a> <a href="https://google.com" class="link" >Text Node</a> @using (Html.Glass().BeginRenderLink(m => m.Link, new { @class =...
1
vote
1answer
439 views

Mapping an interface template to a concrete class template in Code?

I have a Droplink type field called Formatter on a Table Column item. I would like GlassMapper to automatically map the selected value in the DropLink to the concrete class. Is this possible? using ...