Only difference is that in you're example you create it first and in the wiki it's already created. Could you try if it works for an item which already exists?
It works for Documents already created and for Documents created as the code example shows above, however only if the property is a textbox or label, but if the property is a Dropdown list as in my code example above, the property doesn't get set.
Maybe you're trying to store the wrong data? Have you looked at how it's stored in the umbraco.config file? Maybe you need to store it like that when you want to save it.
Please elaborate... If all the UMB controls are .NET controls maybe I can bind to it as shown here: our.umbraco.org/.../getprevalues, the only concern is getting the control ID name correct, as firebug shows: <select id="body_prop_electionYear" name="ctl00$body$prop_electionYear"> so I'll do a findcontrol() and try to bind to "body_prop_electionYear" and see what happens.
I'm not attempting to save the id at all... I was making a suggestion on trying to set the property via server control databinding since the regular way doesn't work. E.G:
aDoc.getProperty("status").Value="married"; // WORKS FOR A UMB TEXTSTRING PROPERTY aDoc.getProperty("status").Value="married"; // WORKS FOR A UMB LABEL PROPERTY aDoc.getProperty("status").Value="married"; // DOES NOT WORK FOR A UMB DROPDOWN PROPERTY
Creating a Document + Settings Properties in same code block
UMB 4.5.2
I'm attempting to set document properties immediately after creation but when doing so with the following code the properties aren't set.
Looks like you're doing everything the same as in this wiki: http://our.umbraco.org/wiki/reference/api-cheatsheet/modifying-document-properties.
Only difference is that in you're example you create it first and in the wiki it's already created. Could you try if it works for an item which already exists?
Jeroen
CORRECTION [UMB 4.7.1]
It works for Documents already created and for Documents created as the code example shows above, however only if the property is a textbox or label, but if the property is a Dropdown list as in my code example above, the property doesn't get set.
Maybe you're trying to store the wrong data? Have you looked at how it's stored in the umbraco.config file? Maybe you need to store it like that when you want to save it.
Jeroen
Please elaborate... If all the UMB controls are .NET controls maybe I can bind to it as shown here: our.umbraco.org/.../getprevalues, the only concern is getting the control ID name correct, as firebug shows:
<select id="body_prop_electionYear" name="ctl00$body$prop_electionYear"> so I'll do a findcontrol() and try to bind to "body_prop_electionYear" and see what happens.
What if you try to save the text instead of the id which you databind to your dropdownlist. For example something like this:
Jeroen
I'm not attempting to save the id at all... I was making a suggestion on trying to set the property via server control databinding since the regular way doesn't work.
E.G:
is working on a reply...