Copied to clipboard

Flag this post as spam?

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


  • Anton 135 posts 186 karma points
    Feb 15, 2012 @ 08:34
    Anton
    0

    How I can get all values of data type?

    I have data type, that has four different values. How I can get all values of data type or  a definite value?

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 15, 2012 @ 15:05
    Tom Fulton
    0

    Hi Anton,

    This depends on which datatype you are using.  Most datatypes that allow the user to select multiple values store them either in CSV or XML format.  Or are you actually wanting to retrieve the possible "prevalues" (ie for the Dropdown datatype)?  Which datatype are you using?

    -Tom

  • Anton 135 posts 186 karma points
    Feb 15, 2012 @ 21:58
    Anton
    0

     

    My own datatype, Render Control: Dropdown list. With database datatype Ntext

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 16, 2012 @ 22:17
    Tom Fulton
    0

    Hi,

    Here's one way to get all the prevalues of your datatype:  GetPreValues

    Here's another way:

                var prevalues = umbraco.cms.businesslogic.datatype.PreValues.GetPreValues(1132);
                IDictionaryEnumerator ide = prevalues.GetEnumerator();
                while (ide.MoveNext())
                {
                    PreValue pv = (PreValue)ide.Value;
                    Literal1.Text += pv.Value + "<br/>";
                }

    HTH,
    Tom

  • Anton 135 posts 186 karma points
    Feb 16, 2012 @ 22:22
    Anton
    0

    Hi, thanks. And how I can set values? I can create new node, but I dont now how set values in my data type by API.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 16, 2012 @ 22:24
    Tom Fulton
    0

    Is this the same question as your other thread?  I think the problem was you need to set it to the ID of the prevalue rather than the text value of it.  In the above code you could get that from pv.Id

    -Tom

  • Anton 135 posts 186 karma points
    Feb 16, 2012 @ 22:31
    Anton
    0

    Yes it is the same  question.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 16, 2012 @ 22:34
    Tom Fulton
    0

    Yep, in that case see what I said above - instead of setting it to "US" you need to set it to the ID of the Prevalue with the Value of "US".

    You could get the ID by writing a quick method to enumerate through the prevalues using the above code and find the one you're looking for and grab it's ID.

    -Tom

  • Anton 135 posts 186 karma points
    Feb 16, 2012 @ 22:38
    Anton
    0

    doc.getProperty(" MY_Dropdown_list_datatype").Id = 18;

    'umbraco.cms.businesslogic.property.Property.Id' -- Read only

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 16, 2012 @ 22:39
    Tom Fulton
    1

    Sorry, you still want to set the Value of the property, you just want to set it to the ID of the prevalue, ex:

    doc.getProperty(" MY_Dropdown_list_datatype").Value = 18;

    (or it may be "18" - can't remember)

    -Tom

  • Anton 135 posts 186 karma points
    Feb 16, 2012 @ 22:43
    Anton
    0

    It is work!!!!!!

    doc.getProperty(" MY_Dropdown_list_datatype").Value = "18";

    Thank you Tom, very much!


Please Sign in or register to post replies

Write your reply to:

Draft