Copied to clipboard

Flag this post as spam?

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


  • Natasha 79 posts 195 karma points
    Jan 27, 2016 @ 16:49
    Natasha
    0

    Data tables/Grid view

    Hi there

    I am trying to implement a datatable which should have the childnodes listed as table rows with 2 other page properties - last updated and theme. I am really struggling to understand how this works. I have some of a .cs I needs help with completing it, I also need to know where the corresponding ascx.cs file goes and then how I reference the above files so it shows of the page.

    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class Practice : System.Web.UI.UserControl
    
    DataTable dt = new DataTable("myDataTable");
    dt.Columns.Add("col1")
    DataRow = dt.NewRow();
    foreach(Node n in nyNodes.Children){
    row["col1"] = document.GetProperty("foo").Value;
    dt.Rows.Add(row);
    }
    myGridview.DataSource = dt;
    myGridview.DataBind();
    

    Please help.

    Thanks in advance Natasha

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 31, 2016 @ 16:57
    Jeroen Breuer
    0

    Hello,

    What version of Umbraco are you using? This code seems for Umbraco 6. In Umbraco 7 this doesn't work anymore. This blog might help: http://24days.in/umbraco/2015/custom-listview/

    Jeroen

  • Natasha 79 posts 195 karma points
    Feb 01, 2016 @ 15:15
    Natasha
    0

    Hi Jeroen

    I am using version 6.1.6. I can't seem to find any information anywhere about it.

    Thanks Natasha

  • Samira 113 posts 452 karma points
    Feb 05, 2016 @ 11:34
    Samira
    0

    Hi Natasha

    Try this to fetch data

                umbraco.presentation.nodeFactory.Node nodeB = new umbraco.presentation.nodeFactory.Node(nodeNum);
                foreach (umbraco.presentation.nodeFactory.Node childNode in nodeB.Children)
                {
                   int id = childNode.Id;
                   Document doc = new Document(id);
    
    
                 }
    

    hope this help

    Regards

    Samira

Please Sign in or register to post replies

Write your reply to:

Draft