-1

We are using Glass Mapper to map the values from Sitecore. System.Collection.Specialized.NameValueCollection is used in Glass Mapper class to map Name Value List from Sitecore.

This example data is correctly working

column1css:test1
column2css:test2

But the below example is mapping only the first item

column1css:test1 test3
column2css:test2 test4

The second item is not mapping. Please mind the space between the values.

1
  • Is the data getting saved in the field properly (if you show raw values, does it store the data correctly)? Commented Mar 29, 2019 at 11:04

2 Answers 2

0

It is not clear what do you use for Key and what for Value. If your case is: enter image description here

It should work (be mapped) correctly:

public interface INameValueList : ISitecoreItem
{
    [SitecoreField("Values")]
    NameValueCollection Values { get; set; }
}

enter image description here

Just check your solution, it is not GlassMapper bug. Value can be any string. Whitespaces are not allowed for Key only (if you try for example to set Key value to "test1 test3" if will be replaced with "test1_test3" automatically on item save).

-1

We ran into that issue as well. We were able to resolve it by following this blog post.

https://trnktms.com/2016/10/15/sitecore-name-value-list-field-with-special-characters/

One thing to note is that you need to provide the assembly and class when you add the item to the core DB.

enter image description here

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.