umbraco.decimal doesn't seem to work with setvalue in umbraco 7.4 beta 2
Using Umbraco 7.4 Beta 2 which was installed and upgraded through nuget.
I'm having an issue where I have an Umbraco.Decimal Proprerty Type attached to a document type.
Here is the property type -
I'm creating a new node of content in an API, and it keeps throwing errors.
IContent pieceOfContent = _contentService.CreateContent("name of node", parentNode, "contentType");
pieceOfContent.SetValue("decimalProperty", .5);
When I run this, it throws an error on the SetValue line.
Object {Message: "An error has occurred.", ExceptionMessage: "The best
overloaded method match for 'Umbraco.Core…Value(string, string)' has
some invalid arguments", ExceptionType:
"Microsoft.CSharp.RuntimeBinder.RuntimeBinderException", StackTrace: "
at CallSite.Target(Closure , CallSite , Object
…tpControllerDispatcher.
If I run the same line above as:
pieceOfContent.SetValue("decimalProperty", 1);
It works.
So I don't know if I'm doing something wrong, Or if there is a bug.
So looking at the source, it ends up calling methods in the contentbase.cs file. I see ones for bool, datetime, httppostedfilebase, httppostedfilewrapper, int, long, and string.
If I convert to a string, it works...but really...there should be a way to get a double or decimal without having to convert it first to a string.
umbraco.decimal doesn't seem to work with setvalue in umbraco 7.4 beta 2
Using Umbraco 7.4 Beta 2 which was installed and upgraded through nuget.
I'm having an issue where I have an Umbraco.Decimal Proprerty Type attached to a document type.
Here is the property type -
I'm creating a new node of content in an API, and it keeps throwing errors.
When I run this, it throws an error on the SetValue line.
If I run the same line above as:
It works.
So I don't know if I'm doing something wrong, Or if there is a bug.
Thanks, C
Hi Chad,
I don't know if this will solve the issue but have you tried 0.5 instead of .5? It could be fact it starts with a . causing the issue?
Ok. Tried, that. Still no go. If I send it as an integer or a string it works. Decimals don't work.
So looking at the source, it ends up calling methods in the contentbase.cs file. I see ones for bool, datetime, httppostedfilebase, httppostedfilewrapper, int, long, and string.
If I convert to a string, it works...but really...there should be a way to get a double or decimal without having to convert it first to a string.
Made a pull request, but the workaround is to convert the decimal/double to a string.
is working on a reply...