Welcome Guest Search | Active Topics | Sign In | Register

XML File Structure for binding to a TreeView Control in ASP.NET 1.1 Options
Peter
Posted: Thursday, December 6, 2012 8:10:50 PM
Rank: Member
Groups: Member

Joined: 8/30/2011
Posts: 17
I have an ASP.NET 1.1 application and I'm trying to create a document hierarchy via the EO.WEB treeview control. I've created a simple XML file and can bind it to the treeview control by specifying the path to the XML file but it doesn't display what I thought it would. I have a valid EO.WEB.LICX file.

In essence, I need to have a theoretically unlimited number of levels although practically it will be more like 3 or 4. For example, I might have a Category called "Manufacturing" with a Sub-category of "Audit Reports" with Sub-sub-categories of "Internal" and "External". I want my treeview to look something like the following:

Manufacturing
Audit Reports
Internal
External
Certificates, Policies & Organisation Chart
Dashboards and Safety Alerts
Forms
Other Documents
Procedures
Safe Working Procedures
Standards
Export
Finance, Travel & Legal
Human Resources
Internal Audit Schedules & Report Template
etc.

I'm initially trying to do this via an XML file because I think the data binding is easier but I also have SQL 2000 tables that I can use to create the same hierarchy.

Here's the XML I'm trying to use. I know there are logic errors in it but I'm trying to figure out what works and what doesn't.

<?xml version="1.0" encoding="utf-8" ?>
<Document_Hierarchy>
<Manufacturing ID ="1">
<Audit_Reports ID="101">
<External ID="1011"/>
<Internal ID="1012"/>
</Audit_Reports>
<SubCategory Name="Certificates_Policies_#x0026_Organisation_Chart" ID="102"/>
<SubCategory Name="Dashboards and Safety Alerts" ID="103"/>
<SubCategory Name="Forms" ID="104"/>
<SubCategory Name="Other Documents" ID="105"/>
<SubCategory Name="Procedures" ID="106"/>
<SubCategory Name="Safe Working Procedures" ID="107"/>
<SubCategory Name="Standards" ID="108"/>
</Manufacturing>
<Category Name="Export" ID="2"/>
<Category Name="Finance, Travel #x0026 Legal" ID="3"/>
<Category Name="Human Resources" ID="4"/>
<Category Name="Internal Audit Schedules #x0026 Report Template" ID="5"/>
<Category Name="Other" ID="6"/>
<Category Name="Distribution" ID="7">
<SubCategory Name="Audit Reports" ID="701">
<SubSubCategory Name="Internal - Quality" ID="7011"/>
<SubSubCategory Name="External - Quality" ID="7012"/>
</SubCategory>
<SubCategory Name="Cards" ID="702">
<SubSubCategory Name="Blister Cards" ID="7021"/>
<SubSubCategory Name="Header Cards" ID="7022"/>
</SubCategory>
<SubCategory Name="Forms" ID="703"/>
<SubCategory Name="Other" ID="704"/>
<SubCategory Name="Procedures #x0026 Plans" ID="705"/>
<SubCategory Name="Service" ID="706"/>
<SubCategory Name="SOPs, SOMs and QIPs" ID="707"/>
<SubCategory Name="Top Level Documents" ID="708"/>
<SubCategory Name="Work Instructions #x0026 Flowcharts" ID="709"/>
</Category>
<Category Name="SOX Procedures" ID="8"/>
<Category Name="Traffic" ID="9">
<SubCategory Name="AD - Activity Descriptions" ID="901"/>
<SubCategory Name="Audit Reports" ID="902">
<SubSubCategory Name="Internal - Quality" ID="9011"/>
<SubSubCategory Name ="External - Quality" ID="9012"/>
</SubCategory>
<SubCategory Name="Forms" ID="903"/>
<SubCategory Name="Mitcham" ID="904"/>
<SubCategory Name="OD - Operations Descriptions" ID="905"/>
<SubCategory Name="PD - Process Descriptions" ID="906"/>
<SubCategory Name="PL - Packing Lists" ID="907"/>
<SubCategory Name="PTIPS" ID="908"/>
<SubCategory Name="QM - Top Level Documents" ID="909"/>
<SubCategory Name="WI - Work INstructions" ID="910"/>
</Category>
</Document_Hierarchy>

I've correctly specified the relative path to the file and tried to set the DataFields property to Name|ID but I only get the names like category and SubCategory, rather than the values form the XML file.

Any assistance would be greatly appreciated.

Thanks and best regards
eo_support
Posted: Thursday, December 6, 2012 10:31:21 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

You need to add the following code inside the TopGroup block:

Code: HTML/ASPX
<Bindings> 
    <eo:DataBinding Property="Text" DataField="@Name"> 
    </eo:DataBinding> 
</Bindings>


That will take the value of your "Name" attribute and assign to the TreeNode's Text property.

Thanks!
Peter
Posted: Thursday, December 6, 2012 11:03:18 PM
Rank: Member
Groups: Member

Joined: 8/30/2011
Posts: 17
Thanks for your prompt response.

Do I add this to the top of my XML file like this?

<?xml version="1.0" encoding="utf-8" ?>
<Document_Hierarchy>
<Bindings>
<eo:DataBinding Property="Text" DataField="@Name">
</eo:DataBinding>
</Bindings>

When I do this I get an error saying the "Namespace prefix 'eo' is not defined. Would I also do something similar to bind the Value field, for example, <eo:DataBinding Property="Value" DataField="@ID">

Thanks and best regards

Peter
eo_support
Posted: Thursday, December 6, 2012 11:40:56 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

No. Take a look of this link for more details:

http://www.essentialobjects.com/doc/1/menucommon/databinding/populate_datasource.aspx

Thanks!
Peter
Posted: Friday, December 7, 2012 12:11:25 AM
Rank: Member
Groups: Member

Joined: 8/30/2011
Posts: 17
OK, thanks. I have two remaining minor issues, as follows:

1. How do I display an ampersand (&) as part of a text string, for example, "Internal Audit Schedules & Report Template"
2. To access the ID do I add <eo:DataBinding Property="Value" DataField="@ID">? I need this ID value to access the records in the database within the same category.

Thanks and best regards

Peter
Peter
Posted: Friday, December 7, 2012 12:54:35 AM
Rank: Member
Groups: Member

Joined: 8/30/2011
Posts: 17
Hi,

I've solved the ampersand problem (&amp;) but need to get the ID value of the treeview node that was clicked. Do I use the ItemClick event for that, because nothing seems to be returned when I try the following code :

MsgBox(e.NavigationItem.Value) OR
MsgBox(e.TreeNode.Value) OR
MsgBox(e.TreeNode.Selected.ToString())

Thanks and best regards

Peter
Peter
Posted: Friday, December 7, 2012 1:56:08 AM
Rank: Member
Groups: Member

Joined: 8/30/2011
Posts: 17
Thanks for your help and ignore my last post. I've worked out how to get the node name and value and everything is now functioning as I need it to.

Thanks and best regards

Peter


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.