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
    Fengelz
    0

    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 5060 posts 15522 karma points MVP admin hq
    Apr 12, 2011 @ 14:21
    Sebastiaan Janssen
    0

    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
    Fengelz
    0

    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:

Draft