Copied to clipboard

Flag this post as spam?

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


  • Touhid 97 posts 117 karma points
    Jan 07, 2011 @ 05:35
    Touhid
    0

    work with gridview and user control in umbraco 4.5.2

    Hi

    I have some child node. Now i want to show my child node in grid view using user control.

    Can any one help me what are syntex of gridview in user control for child node.

     

    Touhid

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Jan 07, 2011 @ 08:47
    Darren Ferguson
    0

    Have a look at NodeFactory:

    http://our.umbraco.org/wiki/reference/api-cheatsheet/working-with-the-nodefactory

    From memory you can set the Gridview source to:

    Node.GetCurrent.ChildrenAsTable();

    Aternatively look into Linq2Umbraco.

  • Touhid 97 posts 117 karma points
    Jan 07, 2011 @ 10:58
    Touhid
    0

    Hi

    I have used a gridview in asp.net design side, which is:

     

    <

     

    asp:GridView ID="vessel" runat="server" AutoGenerateColumns="false">

     

    <Columns>

     

    <asp:TemplateField HeaderText="Vessel">

     

    <ItemTemplate>

     

    <asp:TextBox ID="vesselNameTextBox" Text='<%#Bind("vesselName") %>' runat="server"></asp:TextBox>

     

    </ItemTemplate>

     

    </asp:TemplateField>

     

     

    <asp:TemplateField HeaderText="Position">

     

    <ItemTemplate>

     

    <asp:TextBox ID="positionTextBox" Text='<%#Bind("position") %>' runat="server"></asp:TextBox>

     

    </ItemTemplate>

     

    </asp:TemplateField>

     

     

    <asp:TemplateField HeaderText="Date">

     

    <ItemTemplate>

     

    <asp:TextBox ID="dateTextBox" Text='<%#Bind("date") %>' runat="server"></asp:TextBox>

     

    </ItemTemplate>

     

    </asp:TemplateField>

     

     

    <asp:TemplateField HeaderText="Dir">

     

    <ItemTemplate>

     

    <asp:TextBox ID="dirTextBox" Text='<%#Bind("dir") %>' runat="server"></asp:TextBox>

     

    </ItemTemplate>

     

    </asp:TemplateField>

     

    </Columns>

     

    </asp:GridView>

    And my user control cs code is :

    umbraco.presentation.nodeFactory.

    Node node = new umbraco.presentation.nodeFactory.Node(1243);

    umbraco.presentation.nodeFactory.

    Nodes childrenNodes = node.Children;

    Here, 1243 is parent node id, but it has some child node. So how can i get the all child node value using cs code.

    Above the asp.net code the vesselName, position, date and dir are child node page field. i want show then in different textbox.

    pls help me.

     

    Touhid

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Jan 07, 2011 @ 11:01
    Darren Ferguson
    0

    for a Gridview you'd want to do:

    var node = new Node(1243);
    var childern = node.
    ChildrenAsTable();

    GridView1.DataSource = children;
    Gridview1.DataBind();

     

     

  • Touhid 97 posts 117 karma points
    Jan 07, 2011 @ 11:08
    Touhid
    0

    yeh, I want to show all of child node value using gridview.

  • Max 144 posts 166 karma points
    Apr 08, 2011 @ 07:21
    Max
    0

    what if i dont want to use 1243 or any node id i want the control to fid the Parent NodeIt by itself is that possible

     

  • Pasang Tamang 258 posts 458 karma points
    Apr 08, 2011 @ 08:01
    Pasang Tamang
    0

    Hi max

    If you want to get the id of selected node then you can use Request.QueryString["Id"]. From this id you can get the parent node of selected node too.

    Thanks

    Pnima

  • Michael Latouche 504 posts 819 karma points MVP 3x c-trib
    Apr 08, 2011 @ 09:49
    Michael Latouche
    0

    Hi Max,

    I think Pnima's solution assumes that you pass your node ID as parameter to your page's querystring.Is this what you had in mind, or else, what did you mean by "find the Parent Node id" by itself? Use the current page ID as parent Id?

    Cheers,

    Michael.

  • Max 144 posts 166 karma points
    Apr 08, 2011 @ 13:32
    Max
    0

    What if i want a Link Button on top of the Gridview when the Button is clicked it wil show the create Content Popup when u create content document under a root node That screen to show cos i dotn want to programatically create docuements and give it name programatically..

     

  • Max 144 posts 166 karma points
    Apr 11, 2011 @ 10:58
    Max
    0

     User user = User.GetUser(0);
             
                Node node = new Node(Convert.ToInt32(Request.QueryString["id"]));
              
               
       
                 DataTable dt = node.ChildrenAsTable();

            

                this.GridView1.DataSource = dt;
                this.GridView1.DataBind();

    I use this code But i want to databind a Document Property example "Name"  in the Gridview it does not work any idea how i can Databind a Document property of teh child nodes in The Gridview

Please Sign in or register to post replies

Write your reply to:

Draft