Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Fengelz 106 posts 221 karma points
    Apr 12, 2011 @ 14:11

    Handling Textstrings and Decimals in Razor?

    It just dawned on me that if i have a property on a node with the type of textstring, and i save a commaseparated string of integers fx (45,56,432,463,643); the value is converted to a decimal value, which prevents me from using Split(',').

    For the moment I just separated using ';' instead of ',' but it has presented a problem before, where I needed a specific value.

    What is the best way/best practice to handle this situation?

    Best regards

    - Sune

  • Sebastiaan Janssen 4890 posts 14567 karma points MVP admin hq
    Apr 12, 2011 @ 14:21
    Sebastiaan Janssen

    Currently, I'm just using GetProperty to get a string value:

    var splitter = Model.GetProperty("yourPropertyAlias").ToString().Split(',')
  • Fengelz 106 posts 221 karma points
    Apr 12, 2011 @ 14:30

    Thanks for the tip. Wasn't sure wether Model.GetProperty would return a string or a dynamic property.

Please Sign in or register to post replies

Write your reply to: