Copied to clipboard

Flag this post as spam?

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


  • Peter Grillo Frederiksen 34 posts 67 karma points
    Mar 18, 2010 @ 09:27
    Peter Grillo Frederiksen
    0

    Dropdown-list and PreValues

    Hello there.

    First of all, I would like to say, that I'm a noob in Umbraco, so please don't "kill" me, with my stupid questions.

    I have a member-node, which contains this: 

    <data alias="playerposition"><![CDATA[Midtbane,Angriber]]></data>

    Now I'm trying to pull this information into at .net UserControl. I've come pretty far, and right now, I have some code:

    Property myMemberLegs = myMember.getProperty("playerposition");
    PlayerPositionLabel.Text = myMemberLegs.Value.ToString();

    And the the problem appears. Now it doesn't write "Midtbane,Angriber", now it writes "19,20" which is the Value and not the Text.

    I've tried to make the Data Type as a DropDown and a DropDown Publish Keys. But nothing works.

    Can somebody help me? 

    I now it's easier to make it in XSLT but it's a UserControl, where a member can edit his/her information.

    Thanks //Peter

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 18, 2010 @ 10:14
    Douglas Robar
    0

    Welcome to umbraco, Peter!

    The only 'stupid' question is the one you don't ask. Feel free to ask as much as you like on the forum. Okay? Okay.

    What you're getting back from your property is a list of the ID's associated with the prevalues you've defined in your datatype. To look up the ID's actual text, have a look at umbraco.library.GetPreValueAsString(id);

    More info here: http://umbraco.org/apiDocs/html/M_umbraco_library_GetPreValueAsString.htm and http://umbraco.org/apiDocs/html/AllMembers_T_umbraco_library.htm

    cheers,
    doug.

     

  • Peter Grillo Frederiksen 34 posts 67 karma points
    Mar 18, 2010 @ 10:26
    Peter Grillo Frederiksen
    0

    Thanks for the reply Doug.

    I know GetPreValueAsString, and I've tried it, but without any luck at all.

    Could you maybe tell me what I'm doing wrong here:

    PlayerPositionLabel.Text = myMemberLegs.GetPreValueAsString();

    Cause it doesn't seem to work :(

Please Sign in or register to post replies

Write your reply to:

Draft