Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • karie 2 posts 72 karma points
    Jan 05, 2018 @ 14:59
    karie
    0

    Error Cannot implicitly convert type 'Umbraco.Core.Dynamics.DynamicNull' to '...' when render partial

    Hi, I have issue with rendering of a partial view Header. I have a controller which is incherited from SurfaceController.

       // GET: Header
        public ActionResult Index()
        {
            var content = Umbraco.Content(1054);
            Header viewModel = content.MapTo<Header>();
            return PartialView("Header", viewModel);
        }
    

    When I try to MapTo it gives me an error Cannot implicitly convert type 'Umbraco.Core.Dynamics.DynamicNull' to 'FormsWorkflow.UmbracoPortal.Models.Pages.Header'. Content contains properties list with my component. Can you please help..What is wrong?

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jan 05, 2018 @ 16:26
    Alex Skrypnyk
    0

    Hi Karie

    What is 'Header' type in your code?

    Umbraco.Content(1054) returns dynamics, it's definitely can't be a 'Header', so this code is wrong

    Thanks,

    Alex

  • karie 2 posts 72 karma points
    Jan 09, 2018 @ 10:13
    karie
    0

    Thanks, ok) What is the alternative?

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jan 09, 2018 @ 10:21
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies