Copied to clipboard

Flag this post as spam?

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


  • Kittisart Sawangbumrung 5 posts 21 karma points
    Jul 30, 2009 @ 12:22
    Kittisart Sawangbumrung
    0

    Custom Section with delete node

    Hello Everyone,

                            I already create custom section in backend of umbraco, everything work fine(add, update) except deleting node( right click on node and click delete). , I follow http://www.nibble.be/?p=71 to implement my custom section. I try to comment code in method ITask.Delete but error still happen. The error that I got is "Sys.Net.WebServiceFailedException: The server method ‘Delete’ failed with the following error: System.NullReferenceException– Object reference not set to an instance of an object" it show in javascript error in status bar of IE8 . Any solution to solve the problem ?.

                            Umbraco V 4.0.2.1

                           .Net V 3.5

                           Window Xp IIS6

                            Here is source code on deleting:                         

     

    bool ITask.Delete()

    {

     

    /*string id = helper.Request("id");

    if (string.IsNullOrEmpty(id))

    {

    return false;

    }*/

     //this.m_parentID = Convert.ToInt32(id);

     

     

    ShopManagement shopManagement = ShopManagement.GetShopById(this

    .m_parentID);

     

    if (shopManagement == null

    )

     

    return false

    ;

    shopManagement.Delete();

     

    return true

    ;

     

    Here is source code on render:

     

    public override void Render(ref XmlTree tree)

    {

     

    List<ShopManagement> shopList = ShopManagement.GetAllShop();

     

    if (shopList != null)

    {

     

    foreach (ShopManagement shopmgn in shopList)

    {

     

     

    XmlTreeNode node = XmlTreeNode.Create(this);

    node.NodeID = shopmgn.Id.ToString();

    node.Action =

    string.Format("javascript:openShop({0});", shopmgn.Id.ToString());

    node.Icon =

    "folder.gif";

    node.OpenIcon =

    "folder_o.gif";

    node.Text = shopmgn.Name;

     

    //node.Source = this.GetTreeServiceUrl(node.NodeID);

    tree.Add(node);

    }

     

    }

     

     

     

    }

     

    public override void RenderJS(ref StringBuilder Javascript)

    {

    Javascript.Append(

     

    @"

    function openShop(id) {

    parent.right.document.location.href = 'apw/controls/shop/Shop.aspx?id=' + id;

    }

    "

     

    );

    }

    Thanks in advance,

    Ks

     

     

     

     

  • Kittisart Sawangbumrung 5 posts 21 karma points
    Jul 31, 2009 @ 06:01
    Kittisart Sawangbumrung
    0

    OK, I got it, this problem was solved

  • Lee 1130 posts 3088 karma points
    Jul 31, 2009 @ 07:13
    Lee
    0

    Please put the answer and I'll mark it as the answer for you

  • Roel Snetselaar 151 posts 305 karma points
    Jul 31, 2009 @ 08:49
    Roel Snetselaar
    0

    yes please provide us with the answer for future reference, nice last name btw :)

  • Antoine 176 posts 1494 karma points
    Nov 12, 2010 @ 10:47
    Antoine
    0

     

    I suppose that the problem comes from the names of the nodeType, RootNode and his child nodes must have the same name. Another solution maybe define 2 different nodeTypes in UI.xml.

     

  • TimNape 12 posts 32 karma points
    Jun 09, 2011 @ 15:35
    TimNape
    0

    I am having the same problem - please elaborage - thanks in advance

Please Sign in or register to post replies

Write your reply to:

Draft