Copied to clipboard

Flag this post as spam?

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


  • Matt Taylor 873 posts 2086 karma points
    Jun 30, 2011 @ 14:53
    Matt Taylor
    0

    Databinding nodes to a gridview - best approach

    I've just started experimenting with the nodeFactory and uQuery so it's all very new.

    I wanted to display some properties for some nodes and after watching this video I saw just how easy it could be.

    Using the following code I soon had my list of Cat nodes and all the property values on display.

    GridView1.DataSource = currentNode.ChildrenAsTable("Cats");

    However I noticed it only displayed the immediate child nodes and did not traverse the tree to display nodes further down the tree.

    I then came accross uQuery.GetNodesByType and with the following code I soon had all cats on display no matter what level in the tree there were:

     List<umbraco.presentation.nodeFactory.Node> listNodes = uQuery.GetNodesByType("ProductEvent");
     GridView1.DataSource = listNodes;

    Brilliant, but then I noticed that the properties I had defined were not being displayed as they were before.

    Does anyone have quick tip for how to databind to the nodes of a specific doctype no matter where they are in the tree and still see all the properties?

    Regards,

    Matt

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies