Copied to clipboard

Flag this post as spam?

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


  • Phil Crowe 192 posts 256 karma points
    Apr 21, 2010 @ 10:50
    Phil Crowe
    0

    Forward and Backward buttons

    I have a jquery colorbox which opens up an iframe of a page containing two user controls. The first user control just showed the properites of a specified node, i.e title, image, bodyText. 

    The second usercontrol has forwards and backwards buttons to move from displaying one node to the next. I thought i could do this by using node factory to get all the nodes, putting them into a collection list, find the current node in the list, and then to move up and down the collection list using events on the buttons. But now im kind of stuck on the button events. Is there some way using umbraco api to move from one node to the next? 

    My current code is this:

        protected void Page_Load(object sender, EventArgs e)

        {

            //Get the querystring vlaue 

            string qsValue = Request.QueryString["ID"];

     

            //Get Node at top of the tree. need to get ALL the 'great gran' children of this node

            Node parentNode = new umbraco.presentation.nodeFactory.Node(1125);

            //Gets all of nodes i want to look through. 

            List<Node> mainNodes = new List<Node>();

            AddChildNodes(mainNodes, parentNode);

            foreach (Node ChildNodes in mainNodes)

            {

                //find current node in list by matching the large photo property to ID being passed in through the querystring

                string nodeProperty = ChildNodes.GetProperty("LargePhoto").Value.ToLower();

                if (qsValue == nodeProperty)

                {

                    Node thisIsTheCurrentNode = ChildNodes;

                }

            }

        }

        public void AddChildNodes(List<Node> list, Node parentNode)

        {

            foreach (Node child in parentNode.Children)

            {

                foreach (Node granchild in child.Children)

                {

                    foreach (Node ggranchild in granchild.Children)

                    {

                       // do what you like with the 'docType' object

                        if (ggranchild.NodeTypeAlias.ToLower() != "textpage")

                        {

                            list.Add(ggranchild);

                            AddChildNodes(list, ggranchild);

                        }

                    }

                }

            }

        }

        //use current node to then move up and down list of nodes

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)

        {

           //left button

     

        }

        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)

        {

            //right button

        }

     

    Any IDEAS???

Please Sign in or register to post replies

Write your reply to:

Draft