Using a textstring data type fails in Razor for me
Hi,
I am using a textstring data type in my site to denote jQuery version which would then be written into the textstring data type in the form of "1.5.2", no quotes and it the current version of jQuery I am wanting to support.
When I go to use Razor to retreive it using "@Model.AncestorOrSelf(1).jQueryVersion;" it is being returned as a datetime format for some reason which means it renders to the page as "1/05/2002 12:00:00 AM;"
Am I doing something wrong or is this in fact a bug?
While this does work it is not as I would expect as I can get back values for other datatypes the method I used but seems inconsistent that because the value I had is a number with fullstops between it that it converts to a date.
Using a textstring data type fails in Razor for me
Hi,
I am using a textstring data type in my site to denote jQuery version which would then be written into the textstring data type in the form of "1.5.2", no quotes and it the current version of jQuery I am wanting to support.
When I go to use Razor to retreive it using "@Model.AncestorOrSelf(1).jQueryVersion;" it is being returned as a datetime format for some reason which means it renders to the page as "1/05/2002 12:00:00 AM;"
Am I doing something wrong or is this in fact a bug?
This is a result of the Umbraco Razor implementation trying to ducktype your string. You can force it to be read a string like so:
While this does work it is not as I would expect as I can get back values for other datatypes the method I used but seems inconsistent that because the value I had is a number with fullstops between it that it converts to a date.
is working on a reply...