Copied to clipboard

Flag this post as spam?

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


  • Tony Kiernan 278 posts 341 karma points
    Jun 19, 2012 @ 17:20
    Tony Kiernan
    0

    Getting prevalue value not text

    My docType has a dropdown list to select one of the properties.  If I use

    @Model.dropDownProperty

    I get the 'Text' of the dropdown.  How do I get the value instead? (Which is being recorded in the database)

    @Model.dropDownProperty.Key ?
    @Model.dropDownProperty.Id ?
    @Model.dropDownProperty.PreValue ?
  • Douglas Ludlow 210 posts 366 karma points
    Jun 19, 2012 @ 17:24
    Douglas Ludlow
    0

    You'll have to use the GetProperty method. Something like:

    @Model.GetProperty("dropDownProperty").Value

     

  • Tony Kiernan 278 posts 341 karma points
    Jun 19, 2012 @ 17:46
    Tony Kiernan
    0

    Yeah, that returns the same.  Should I be changing the .Value?

  • Douglas Ludlow 210 posts 366 karma points
    Jun 19, 2012 @ 18:19
    Douglas Ludlow
    1

    Using DynamicNode you're going to be pulling values from the cache, and I don't think they store the actual value, only the text there. If you use Document, you can get to the value stored in the database:

    Document document = new Document(Model.Id);
    @document.getProperty("dropDownProperty").Value



  • Douglas Ludlow 210 posts 366 karma points
    Jun 19, 2012 @ 18:22
    Douglas Ludlow
    0

    ...and you might need to do a ToString() on that value.

  • Tony Kiernan 278 posts 341 karma points
    Jun 19, 2012 @ 18:57
    Tony Kiernan
    0

    Ta.  Not sure I've decided to go about this in the right fashion at all

Please Sign in or register to post replies

Write your reply to:

Draft