Copied to clipboard

Flag this post as spam?

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


  • Jason Burton 13 posts 33 karma points
    Jun 09, 2011 @ 16:14
    Jason Burton
    0

    umbraco.library.niceurl

     // image processing..             prop = node.GetProperty("image");             int EventImageURLID = umbraco.library.NiceUrl(Convert.ToInt32(prop.Value));             evt.EventImage = (Convert.ToInt32(EventImageURLID));

     

    Trying to grab the niceurl for an image.. But says cannot implicitly convert string to int .. any help would be good ... Thanks I think Im having data type issues, thought it was an int32

  • Samuel Hamer 44 posts 66 karma points
    Jun 09, 2011 @ 16:18
    Samuel Hamer
    0

    Its because  umbraco.library.NiceUrl(Convert.ToInt32(prop.Value)); will be returning the url as a string but you have told EventImageURLID that it is an int

  • Samuel Hamer 44 posts 66 karma points
    Jun 09, 2011 @ 16:20
    Samuel Hamer
    0

    If you just want the id of the document then you should cut the umbraco.library.NiceUrl out and just have int EventImageURLID = Convert.ToInt32(node.GetProperty("image").Value); 

  • Jason Burton 13 posts 33 karma points
    Jun 09, 2011 @ 16:25
    Jason Burton
    0

    Trying to create a property for the node, is there a better way to get that data? ie. So I can set it as the ImageURL in an asp.net control ?

  • Samuel Hamer 44 posts 66 karma points
    Jun 09, 2011 @ 17:06
    Samuel Hamer
    0

     

    If you are trying to get the URL programatically I think you can use the code you had in the first post, just change the int to a string;

    string EventImageURL = umbraco.library.NiceUrl(number of node id);

    I am not sure a node can have properties, but to change a property of a Document you can use;

    Document.getProperty("property").Value = "string";

    (This is assuming the property on the document already exists, if you are needing one added programatically I think you can use Document.addProperty)

     

Please Sign in or register to post replies

Write your reply to:

Draft