473,508 Members | 2,374 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML Treeview Asp.net - help

5 New Member
I have a treeview wich populates from a xml file - it all works dandy...
but i am not satisfied...
this is my xml file...

<?xml version="1.0" encoding="utf-8"?>
<ProductsList>
<Category Name="Coffee">
<Products>1231</Products>
<Company>qwd</Company>
<Information>qdwd</Information>
</Category>
<Category Name="Coffee">
<Products>ewffw</Products>
<Company>ewf</Company>
<Information>fwef</Information>
</Category>
</ProductsList>

The problem is that my treeview shows my xml like this...

+Home
- Coffee
1231
- Coffee
ewffw

what i would like is to show it like this...

+ Home
- Coffee
1231
ewffw


Is my XML file wrong??? - i am new to XML...

protected void Button1_Click(object sender, EventArgs e)
{

string name = this.DropDownList1.Text.Trim();

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath(@"App_Data/Products.xml"));

XmlElement xmlCategory = xmlDoc.CreateElement("Category");
XmlElement xmlProducts = xmlDoc.CreateElement("Products");
XmlElement xmlCompany = xmlDoc.CreateElement("Company");
XmlElement xmlInformation = xmlDoc.CreateElement("Information");

xmlCategory.SetAttribute("Name", name);
xmlProducts.InnerText = this.TextBox1.Text.Trim();
xmlCompany.InnerText = this.TextBox2.Text.Trim();
xmlInformation.InnerText = this.TextBox3.Text.Trim();

xmlCategory.AppendChild(xmlProducts);
xmlCategory.AppendChild(xmlCompany);
xmlCategory.AppendChild(xmlInformation);
xmlDoc.DocumentElement.AppendChild(xmlCategory);

xmlDoc.Save(Server.MapPath(@"App_Data/Products.xml"));
LoadGridView();
}
this creates the current xml. Is there a simple solution to this???
Sep 23 '07 #1
0 984

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2414
by: Sonia Igla | last post by:
Hi. I need to perform DBLCLK on TreeView Node. I try the following: private static extern int SendMessage(IntPtr hWnd, uint msg, UInt32 wParam, UInt32 lParam); private const UInt32...
4
10120
by: Karim El Jed | last post by:
Hi, I'm trying to expand a special Node of my TreeView from Codebehind. I have a TreeView on a page for navigating to another site. On the other tsite here is the same TreeView more precisely a...
2
1526
by: DJG | last post by:
I need some help with a TreeView control in VB.Net I've got a datatable with about 8000 rows. 500 are 'folders', and the other 7500 rows are 'jobs'. It's a logical representation of some data,...
3
10131
by: Jan Wrage | last post by:
Hi! I would like to implement a treeview in my existing application. It should show my entire Active-Directory structure, i.e. all Groups, Containers and OUs. Could somebody help me with...
14
15053
by: Mr.D | last post by:
How do I save/load the contents of a Treeview to a file? I have found several good examples written i VB6, but not a single one for VB.NET. Please help. ---- Tim
3
3802
by: christof | last post by:
I've got a really easy problem, please help me: There are two pages in one I'm creating a TreeView like that: TreeView dbTree = new TreeView(); TreeNode dbTreeRoot = new TreeNode("Root");...
10
2331
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
8
12727
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
7
7818
by: Joe Cool | last post by:
Let's say I have a Treeview control on a form. Each leaf node in the Treeview has a ContextMenuStrip, each with one ToolStripMenuItem, and all ToolStripMenuItems Click event is handled by a comment...
2
5481
by: makennedy | last post by:
Hi Experts, Please help, I am a newbie to ASP.NET 2.0 may be I am doing something wrong or there may be a bug somewhere. Basically I have a TreeView Control which I have created...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.