Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unable to cast" error with Umbraco 7.4.2 and Archetype #43

Open
dreadpiratebrown opened this issue Apr 13, 2016 · 0 comments
Open

"Unable to cast" error with Umbraco 7.4.2 and Archetype #43

dreadpiratebrown opened this issue Apr 13, 2016 · 0 comments

Comments

@dreadpiratebrown
Copy link

Trying to use the Multi Url Picker inside an Archetype data type. Here is my Razor code to get the URL:

var multiUrlPicker = fieldset.GetValue<MultiUrls>("buttonURL");
if (multiUrlPicker.Any())
{
    foreach (var item in multiUrlPicker)
    {
        <p><a href="@item.Url" class="btn btn-primary btn-lg">@fieldset.GetValue("buttonText")</a></p>
    }
}

When I view the page, I get this system error:

Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JArray'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JArray'.

Source Error:

Line 79: @if (fieldset.HasValue("buttonURL"))
Line 80: {
Line 81: var multiUrlPicker = fieldset.GetValue("buttonURL");
Line 82: if (multiUrlPicker.Any())
Line 83: {

Is this something I'm doing wrong, or is it incompatible with 7.4.x?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant