-
parent and child nodes
Hi
i am working in c# with infragistics
In c# windows applicaion, I will be passing data from textbox..such that
for example:i havE 3 texboxes labeled
name:
age:
salary:....
Now name is the parent and age and salary r the child..so if i pass data in
the appropriate textbox..It should be added in the ultrawintree.......such that
name(parent) should show up on the root node of the tree. and age and
salary(child) should show up under the root node.
so now when I run this program, as it reads a xml schema and creates a xml file.. now when I clicked the ADD button, it checks for the xml file and each textbox
is binded to the xml elements..so that the data which is passed in the xml file willbe added in the xml..
now for example i gave john,22,1800 for name,age and salary respectively and again john,45,3800
so it should be shown in teh tree as follows tht john under john both ages and salary should be shown
ie like
parent(name) : john
child(age) : 22 45
child(salary): 1800 3800
but i am getting teh result as follows..
john
22
1800 and again
john
45
3800 seperately.... so please tell me how to do it.
here is my coding part
//FUNCTION FOR ADDINGNODES
private void AddNode(string ParentNAME, string AGE, string SALARY)
{
//add parent node
Infragistics.Win.UltraWinTree.UltraTreeNode parentNAMEnode = new Infragistics.Win.UltraWinTree.UltraTreeNode();
Infragistics.Win.UltraWinTree.UltraTreeNode AGEnode = new Infragistics.Win.UltraWinTree.UltraTreeNode();
Infragistics.Win.UltraWinTree.UltraTreeNode SALARYnode = new Infragistics.Win.UltraWinTree.UltraTreeNode();
//add parent node
parentNAME.Text = ParentNAME;
//other nodes
AGEnode.Text = AGE;
SALARYnode.Text = SALARY;
//add childnodes to parent
parentNAMEnode.Nodes.Add(AGEnode);
parentNAMEnode.Nodes.Add(SALARYnode);
parentNAMEnode.Expanded = true;
//add teh nodes to teh ultratree
ultraTree1.Nodes.Add(parentNAMEnode);
}
//ADD button
private void button1_Click(object sender, System.EventArgs e)
{
DataSet dataSet = new DataSet();
// Read the existing xml
dataSet.ReadXml("..\\..\\resultdata.xml");
//PARENTName TEXTBOX
string strParentNAME = txtParentNAME.Text;
//AGE Text box----int type
string strAGE = txtAGE.Text;
int intAGE;
if (!strAGE.Equals(string.Empty)) // check to make sure the user entered something
intAGE = Convert.ToInt32(strAGE);
//SALARY Text box----int type
string strSALARY = txtSALARY.Text;
int intSALARY;
if (!strSALARY.Equals(string.Empty)) // check to make sure the user entered something
intSALARY = Convert.ToInt32(strSALARY);
//create a new row
DataRow newrow;
newrow = dataSet.Tables[0].NewRow();
// add new row.
newrow["ParentNAME"] = strParentNAME;
newrow["AGE"] = strAGE;
newrow["SALARY"] = strSALARY;
AddNode(strParentNAME,strAGE,strSALARY);
//add the row to the dataset
dataSet.Tables[0].Rows.Add(newrow);
//write the data to a xml file
dataSet.WriteXml("..\\..\\resultdata.xml", XmlWriteMode.WriteSchema);
dataSet.AcceptChanges();
MessageBox.Show("Saved");
}
//form load
private void Form1_Load(object sender, System.EventArgs e)
{
DataSet dataSet = new DataSet();
//read the schema
dataSet.ReadXmlSchema("..\\..\\Menu.xsd");
dataSet.WriteXml("..\\..\\resultdata.xml",XmlWriteMode.WriteSchema);
}
please help me to do this
Similar Threads
-
Replies: 1
Last Post: 06-25-2005, 11:19 PM
-
Replies: 1
Last Post: 02-07-2001, 09:18 PM
-
By Matthew Cromer in forum VB Classic
Replies: 10
Last Post: 09-13-2000, 05:01 AM
-
By Matthew Cromer in forum VB Classic
Replies: 0
Last Post: 09-12-2000, 08:53 AM
-
Replies: 1
Last Post: 04-04-2000, 06:28 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|