.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Adding child nodes to its parent

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :ASP.Net


I would like to add child nodes to its parents using pattern visitor to build tree .

 public interface IVisitor
        void Visit(File file);
        void Visit(Level_1 level);
        void Visit(Level_2 level);
        void Visit(Level_3 level);
        void Visit(Level_4 level);
        void Visit(Level_2 level);
        void Visit(Root root);

 public class TreeViewBuilderVisitor : IVisitor
        private TreeNode _treeNode;

        public TreeNode TreeNode
            get { return _treeNode; }
            set { _treeNode = value; }
        private TreeView _treeview;

        public TreeViewBuilderVisitor(TreeView treeview)
            _treeview = treeview;

        public void Visit(File file)
             TreeNode faTreeNode = new TreeNode(file.Name);

        /// <summary>
        /// </summary>

View Complete Post

More Related Resource Links

Best practice for adding parent-child related ModelVisual3D elements



I have build a WPF application which loads some 3D models. Some of the models have a parent-child relationship, e.g. a tree has some branches and each branch has leaves.

Now I created a class for each type: tree, branch and leave. From within a "branch" object I want to add the leaves with a "AddLeaves()" method. But I don't know what's the best way to access the ViewPort3D object, to which I can add the "leave" objects.

Do I have to implement a "ViewPort3D" member on each class which saves the reference to the viewport? Or is there a easier way to achieve this? Perhaps with DependencyProperies?

How can I access the "children" property of the ViewPort3D object the easiest way?

Please help!!!

GridView Parent Child View with JQuery Effects

I was just checked how to add some more cool effects to the GridView control using JQuery. In this post I will display parent-child data in the GridView control with some help of the wonderful JQuery library.

Let's first populate the GridView control.

Display homepage node along with child nodes


If the first Sitemap node is your homepage/default and all other nodes are supposed to be children / grandchildren of the first sitemap node in a web.sitemap, how do I set up my web.sitemap to enable me to display my cssFriendlyMenu with the homepage node along with the nodes that are 1 level down from it at the same time as in :

Home   Products   Services   About us


...or is it not possible to have the first sitemap node displayed along with the nodes that are 1 level down from it?  Do I need to have a different starting node rather than my homepage node?

How to keep the hover for Parent menu and set the selected menu item css for child menu item?



I'm using cssfriendly control adapter for menu. My asp.net menu control's datasource is a sitemap file I'm using which contains all the urls.

I have the following questions:

  1. Is there a way to keep the parent menu item hovered while hovering over the respective child menu items?
  2. Is there a way to keep the child menu item selected? I am able to set the css for the parent menu, however I was wondering if the same is possible with the child items.

Please help! Smile


Moneka Smile

way of calling "javascript function of parent window from child window."

The article way of calling "javascript function of parent window from child window." was added by raja.s on Sunday, June 06, 2010.

Hi,Here i am going to explain how to call the javascript function of a parent window from the child window(pop-Up).Some may know before reading this post.Parent Java Script Function:script language="Javascript" type="text/javascript">

Child nodes not allowed.


Hi everyone.

I'm positive that, by now, a lot of people have run into this problem but even with all the forum posts with great answers, I still can't seem to get to the bottom of it. Here are some specs:

  • Windows Server 2008
  • Visual Studio 2008 x86

So here's the issue:

I have VS2008 installed on the server listed above. This is our development server and everything is created and tested here. I have created an asp.net application, tested it on the dev. environment and everything works great. When I try to migrate this application up to our Quality Assurance environment (which is Windows Server 2003), I get the error in the subject title.

I've read many things that can be the cause of this and I'm positive that I know 2 ways of fixing it. One is from this post: Simple web site problem on Vista, related to <providerOption>, and the other is making sure 3.5 framework is at least installed on the server in question. There are 2 reasons why I'm unable to use these 2 methods:

  • The patches from DVD that I'm supposed to install won't let me install them. Upon double clicking I recieve a message saying the "Update is not applicable to your computer"
  • I don't have permission to install 3.5 frame

Two modalpopups as a parent-child


When I  open two modalpopups, one over another, there is unexpected order.

After click on "Open Parent Panel", and click on "Open Child Panel",

Child Panel (newone) is under the Parent. 

Uploaded with ImageShack.us

What should I do to get it in "normal order"?

The code is:

    <asp:ScriptManager ID="A" runat="Server">
    <asp:Button id="Z1"  runat="server" Text="Open Parent Panel" 

Display a nested child ListView on PostBack while using DataPager on parent ListView


Hello ASP.NET community,

I am having trouble finding how to solve the following issue :

I am using nested listviews to display Sales and Sales details.

The main ListView displays General Information about Sales and the child ListView displays the detailed information about one sale. the child listview is shown only when the user clicks on a link (see included code, DataBind is made on PageLoad) :

ASPX Markup Code :

<asp:listview id="lvSales" runat="server" onitemdatabound="lvSales_ItemDataBound">
<table cellspacing="0" border="1" width="250" style="border-collapse:collapse;">
<tr runat="server" id="headerRow">
<th scope="col" style="width:30px;"></th>
<th scope="col">SaleNumber</th>
<tr id="itemPlaceHolder" runat="server" enableviewstate="true"/>
<tr id="row" runat="server">
<td style="text-align:center;"><asp:button id="btnShowHideDetails" runat="server" oncommand=&qu

InfoPath and Access - two parent tables and one child table


Hi there,

I'm trying to link an InfoPath form to an Access database, I want to connect the InfoPath form to 3 tables in the Access database but InfoPath will only recognise parent-child relationships in a series (e.g. the "Company" table is the parent to the "Customer" table, which is again parent to the "Orders" table)

I need to have two parent tables and one child table, though (e.g. "Customer" is parent to "Orders", but "Inventory_Item" is also parent to "Orders"). Is there any way to establish this in InfoPath? I'm using Windows XP, InfoPath 2007 and Access 2007.

Cheers, Patrick

parent and child items


I have to create a aspx page where end users can create, edit and delete category and their subCategory from it.

Please suggest what is simple way to do above? using .Net

 PS: a category can have zero or more subcategory and subcategory will not have any of its own subcategory, i.e. there are only two levels.

WPF- Treeview--How to add child nodes-- a Bizzare problem-- plz help

so here it is.... in WPF ... Treeview control -- i can add nodes under root node, using XAML code  which is static i hav to add the nodes, using C# code which is dynamic. For Example: Menu Table MenuId       Name       ParentId     1           Country         0     2           India             1     3           USA              1     4           AP                2     5           UP                2     6           California      3     7           Newyork       3 In my C# Code i took a class file in that, i declared the menu() method of type DataTable. Method menu() :- I created a temptable (using DATATABLE CLASS) with same fields(using CLONE()) and filled it with MENU table data and returned that temptable. So now i have data with me. Based on ParentID i can retrieve the child values. but how to add those values to TREEVIEW as its ITEMS There is no---> " treeview1.Items[0].Items.Add() " thing in WPF--- n its creating problem to me. Hw can i do dat...? i dnt knw which Methods , Properties , Classes  to Use. Ex:       + COUNTRY             + INDIA                    AP                    UP              +USA                    Lusiana                    Nwyrk Please help. Thank you. Beginner in WPF..... VENU.Beginner in WPF.......VENU

Multiple Child Nodes with For XML Path

I am trying to generate this format of xml and having difficulties because of the properties section. I can have unlimited number of properties and "For XML" tells me it can't generate the same node "Properties/@Name". I have tried several methods online, but can't seem to get it to work. OptionLists> <OptionList Name="Functions"> <Option Value="L9496"> <Properties Name="Description" Value="L9496 - Privacy Lock With Indicator" /> <Properties Name="Locked" Value="False" /> </Option> <Option Value="LV9040" /> <Option Value="L9485" /> </OptionList> </OptionLists>   My SQL currently looks like this: SELECT 'Functions' as '@Name', ( Select coalesce(nullif(No_,''),'NONE') "Option/@Value", Case NO_ when isNull(nullif(NO_,''),null) Then 1 Else 99 END "Option/@Order", 'TRUE' "Option/@Visible", 'FALSE' "Option/@Locked", '' "Option/@ToolTip", '' "Option/@ImageLink", '' "Option/@InfoMessage", 'QtySensitive' "Option/Properties/@Name", Case [Quantity Sensitive] When 0 Then 'False' When 1 Then 'True' End "Option/Propert

How to assign data from 1 DataReader into Parent/Child object??

Hi I have a parent & child table. Parent - User UserID UserName Status 1 Shallin A 2 How A   Child - UserAccess UserID Country Default 1 US 0 1 UK 0 1 MY 1 2 SG 0 2 HK 0 2 MY 1   I also have parent & child object class.       I would like to use 1 C# function and 1 SP to handle the retrieve portion but I have 1 problem. I'm not sure how to assign the value from Reader to the object.   I do something like this but I only get 1 country which is the last country. if (dr.HasRows) {     while (dr.Read())     {         User objUser = new User();         objUser.UserID = dr["User_ID"].ToString().Trim();         objUser.UserName = dr["UserName"].ToString().Trim();         objUser.UserStatus = dr["Status"].ToString().Trim();         UserAccess objUserAccess = new UserAccess();         objUserAccess.Country = dr["Country"].ToString().Trim();         objUserAccess.Default = dr["Default"].ToString().Trim();         objUser.UserAccessCollection = new UserA

this.controls.add - not always adding to parent form

My current code (snippet below) iterates through user info and adds the same custom control to a form based on how many "Meals" (1-6) the user has selected.  It appears that all even # controls (the second, fourth and sixth) are added to the previously added control, rather than the parent form, when I later try to dispose the controls by iterating through this.controls, only 1, 3 and 5 appear, the others appear as children to 1, 3 & 5. I've reduced controls size, etc. to make sure they're not overlapping (if that can force inheritence?) but no luck.  Anyone have suggestions on what to look at or other guidance? public void drawMealPanel(Meal m, int x, int y) { Controls.MealDisplay md = new Controls.MealDisplay(m); md.Name = m.name; md.Tag = m.id.ToString(); md.Left = x; md.Top = y; md.DragDrop += new System.Windows.Forms.DragEventHandler(this.MealView_DragDrop); md.DragEnter += new System.Windows.Forms.DragEventHandler(this.MealView_DragEnter); this.Controls.Add(md); }

MDX Query - Get (Parent-Child) Dimension member regarding another Parent-Child Dimension, then, get

Hi there, I got the following MDX issue. My cube structure looks like that : DIMENSION CATEGORY (Parent-Child) --> (Many to many) FCTLESS_CategoryNode <-- DIMENSION NODE (Parent-Child) ___ DIMENSION NODE (Parent-Child) --> (Many to many) FCTLESS_NodeVariable <-- DIMENSION VARIABLE ___ DIMENSION VARIABLE <-- FACT (Supposed with only one value called VALUE) I'd like aggregate for N nodes linked to a specific category. For example, with the next content : DIMENSION CATEGORY - COUNTRY - SITE - BUILDING DIMENSION NODE US (Category Country)     - Site US_A (Category Site)     - Building US_A_A  (Category Building) FR (Category Country)     - Site FR_A (Category Site)     - Building FR_A_A  (Category Building)                                       - Site FR_A (Category Site)     - Building FR_A_B  (Category Building)                                       - Site FR_B (Category Site) 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend