Copied to clipboard

Flag this post as spam?

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


  • Santhosh 58 posts 99 karma points
    Feb 27, 2012 @ 11:37
    Santhosh
    0

    Ajax-Json-Asmx + Node.GetCurrent() "Null reference exception"

    Hi all,

     

    i use asp.net website with Ajax-Json-asmx call. the webmethod tries to access Node.GetCurrent() to get a Node ID for a property. but "Null reference exception" is thrown. below is the code.

    Response.Redirect(
                        umbraco.library.NiceUrl(
                            Convert.ToInt32(Node.GetCurrent().GetPropertyValueRecursive("intLinkHome"))));

     

    Is tehre any way to get the node id in ajax call from umbraco. Thanks in advance for the help.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 27, 2012 @ 12:44
    Jeroen Breuer
    0

    Well because you're in a handler it doesn't know what the current page is. I think it's best to pass the current node id to your ajax call and than get it there.

    Jeroen

  • Santhosh 58 posts 99 karma points
    Feb 27, 2012 @ 12:47
    Santhosh
    0

    ok, Thanks for your reply. You mean to say pass the "Node Id" or the Id which gets generated by this code - Node.GetCurrent().GetPropertyValueRecursive("intLinkHome").

     

    Thanks

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 27, 2012 @ 12:55
    Jeroen Breuer
    0

    I mean pass in the node id.

    In your code pass Node.GetCurrent().Id to your ajax call. In there you can do new Node(id).GetPropertyValueRecursive("intLinkHome") to get the value.

    Jeroen

  • Santhosh 58 posts 99 karma points
    Feb 28, 2012 @ 06:42
    Santhosh
    0

    Thanks Jeroen... It worked... :)

     

Please Sign in or register to post replies

Write your reply to:

Draft