How have you setup the dropdown in the Developer -> Datatypes section? And what does the razor code you have been trying to use for rendering the dropdown look like? And does it result in any kind of errors? If so please add it in here as it makes it a lot easier to help you out :-)
Hi Jan thanks for taking the time to check this out. I'm a front-end guy so these kind of things always get away from me if I can't find any documentation for it.
I'm making a LeBlender control with a list of H1-H6 headings and this is the code that's fetching it:
var heading = string.IsNullOrEmpty(item.GetValue<string>("size")) ? "h2" : UtilityService.GetPreValue(item.GetValue<string>("size")).ToLower();
This returns empty. If I get the value straight from the "size" object I get this: [ "68" ]
This is in an extension class which I can't remember where I got but have been using it with the old Umbraco.Dropdown with great success (pun intended):
public static string GetPreValue(string id)
{
var value = string.Empty;
if (!string.IsNullOrEmpty(id))
{
int preId = 0;
var parse = Int32.TryParse(id, out preId);
if (parse)
{
var helper = new UmbracoHelper(UmbracoContext.Current);
value = helper.GetPreValueAsString(preId);
}
}
return value;
}
Hmm, ok - I must confess that I have not really been using the grid and LeBlender so I'm currently a bit clueless here.
Maybe I can try to recreate things on a clean install - But can you show me some screendumps of your LeBlender setup and Grid? That would probably help me...But I don't guarantee anything :-)
I've just written some documentation for the new dropdown property editor which is currently awaiting a review. In the meantime if you want to have a look at what I've written you can have a look at the draft here (there's a couple of brief code samples in there) but do bear in mind that this is unofficial until it's been reviewed and accepted.
B, it looks like your GetPreValue method would work for the older Dropdown list, publishing keys property editor which saves IDs rather than values. The new dropdown property editor saves the selected value from the dropdown.
Hi James. Thanks for writing the documentation and providing us with the draft. I can see it's more or less like working with any property editor that returns a string.
But my problem is that if I get it like this: (as in your first example)
item.GetValue<string>("size")
Then it returns like this:
[ "68" ]
but I want to get the "nice value" of "H1, H2" etc.
Here are 2 screenshots of
1. The datatype I created for this purpose
2. The LeBlender control.
New Dropdown in Umbraco 7.10.1
Hi all, Where is the best way to get the value of new Dropdown in Umbraco 7.10.1 in Razor.
It didn't found in Umbraco Documents
+1 trying to figure this out as well.
Hi there
How have you setup the dropdown in the Developer -> Datatypes section? And what does the razor code you have been trying to use for rendering the dropdown look like? And does it result in any kind of errors? If so please add it in here as it makes it a lot easier to help you out :-)
Looking forward to hearing from you!
/Jan
Hi Jan thanks for taking the time to check this out. I'm a front-end guy so these kind of things always get away from me if I can't find any documentation for it.
I'm making a LeBlender control with a list of H1-H6 headings and this is the code that's fetching it:
This returns empty. If I get the value straight from the "size" object I get this: [ "68" ]
This is in an extension class which I can't remember where I got but have been using it with the old Umbraco.Dropdown with great success (pun intended):
Thanks again.
Hmm, ok - I must confess that I have not really been using the grid and LeBlender so I'm currently a bit clueless here.
Maybe I can try to recreate things on a clean install - But can you show me some screendumps of your LeBlender setup and Grid? That would probably help me...But I don't guarantee anything :-)
/Jan
Hi Nathan, B,
I've just written some documentation for the new dropdown property editor which is currently awaiting a review. In the meantime if you want to have a look at what I've written you can have a look at the draft here (there's a couple of brief code samples in there) but do bear in mind that this is unofficial until it's been reviewed and accepted.
B, it looks like your
GetPreValue
method would work for the older Dropdown list, publishing keys property editor which saves IDs rather than values. The new dropdown property editor saves the selected value from the dropdown.Hi James. Thanks for writing the documentation and providing us with the draft. I can see it's more or less like working with any property editor that returns a string.
But my problem is that if I get it like this: (as in your first example)
Then it returns like this:
but I want to get the "nice value" of "H1, H2" etc.
Here are 2 screenshots of 1. The datatype I created for this purpose 2. The LeBlender control.
Hi James, my problem like B. Gunnarsson's problem. When I use the new dropdown in LeBlender. And it return [ "68" ].
is working on a reply...