Copied to clipboard

Flag this post as spam?

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


  • Mark Watson 118 posts 384 karma points
    May 31, 2018 @ 07:34
    Mark Watson
    0

    Image not displaying in partial view

    Every time I add this code I get a run time error,

    @{
    var eventsimage = item.GetPropertyValue<IPublishedContent>("eventImage");
    if (eventsimage != null)
    {
    <div style="float:left;padding-right:10px;margin-top:20px;">@eventsimage.Url</div>
        <img src="@eventsimage.Url"  alt="" />
    }} 
    

    I have followed the video several times and can not work this out.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    May 31, 2018 @ 07:37
    Alex Skrypnyk
    0

    Hi MArk

    What error do you see?

    Thanks,

    Alex

  • Mark Watson 118 posts 384 karma points
    Jun 01, 2018 @ 03:02
    Mark Watson
    0

    We get a runtime error

    runtime error

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 01, 2018 @ 03:19
    Jan Skovgaard
    0

    Hi Mark

    If you're not using Umbraco Cloud then please try the following

    Can you go into the web.config in the root of the Umbraco folder and set the configuration of "customErrors" to "Off" like it says on the screen? That way you can see what the actual error is.

    By default the value on the "mode" attribute is set to "RemoteOnly" - You can learn more about the modes and what they mean here https://msdn.microsoft.com/en-us/library/h0hfz6fc(v=vs.100).aspx

    Once you have done that and you have seen the real error message then make sure to set the mode to "RemoteOnly" again since you don't want to expose the error message details to everyone.

    If you ARE using Umbraco Cloud then please go to the "Developer" section and click on the "Trace logs" folder where you can see a bunch of log files. Click on the one with the latest date and click on the "Level" filter and select "Error" to see what the real error message is.

    I hope this makes sense - By figuring out what the real error message is we can better support you in solving the issue you're dealing with.

    I hope this helps and makes sense.

    Looking forward to hearing from you.

    /Jan

  • Mark Watson 118 posts 384 karma points
    Jun 01, 2018 @ 03:56
    Mark Watson
    0

    Thanks Jan

    We are using Umbraco cloud. I have done the above and I get

    An unhandled exception occurred System.Web.HttpCompileException (0x80004005): c:\inetpub\temp\DWASFiles\sites\53e12e4f-bb83-44d6-9fb3-ce745afa138c\VirtualDirectory0\site\wwwroot\Views\EventPage.cshtml
    

    To give you an idea on what i am trying to do. I have created a folder in the media section called Event Images. The customer can upload images through the document type Event Item. Part of the Event Item is an image upload that is stored in the Event Images folder. The event items are displayed on the Event Page with the rest of the Event Item properties.

    I have again tried to follow the video on how to display images and still get this on my partial view and if I try and display just a template. All the other properties display.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Jun 01, 2018 @ 07:29
    Dave Woestenborghs
    0

    Hi Mark,

    You probably have syntax error somewhere.

    Can you post the full code of your view.

    What for me sometimes helps is commenting out all code in the view, and then uncomment things to find the offending line.

    Dave

  • Mark Watson 118 posts 384 karma points
    Jun 04, 2018 @ 00:40
    Mark Watson
    0

    Thanks Dave I have worked this out. I made the mistake of using upload file to upload the image rather than the image media picker. I mistakenly thought you needed to use upload rather than the image media picker. Rookie mistake.

Please Sign in or register to post replies

Write your reply to:

Draft