3

I would like to get null value instead of empty string for 'Single-Line Text' field type with Glass Mapper.

I need to recognize if any value was set or if a field was reseted to default state (and I expect there is no value - null).

Do you know if it's possible?

Lukas Dvorak
  • 481
  • 4
  • 15
  • When you say 'reset to default state', are you checking for the Standard Value of the field? If so, you can leverage the .ContainsStandardValue property of the underlying Field. – Nathan Hase Jun 07 '16 at 13:09
  • Yes, I can do it like this but problem is I am using Glass Mapper and I get model with values. But if I will create custom handler, definitely I will use this property. Thanks – Lukas Dvorak Jun 07 '16 at 13:59

1 Answers1

1

You can try to write a custom Glass.Mapper data handlers.

Check this post:

Custom data handlers

Vlad
  • 211
  • 2
  • 10