473,626 Members | 3,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeView Populated from DB (Error in V.Studio.Net)

Hi Guys,
I have an application below that is treeview menu populated from the
database which works with asp.net webmatrix.But when i put it into code
behind in Visual Studio.Net it gives the errors

"TreeNode Not defined"
"name TreeeView1 not defined"
Can anybody tell me what 'm doing wrong?

Sub Page_load(Sende r As Object, E As EventArgs)
'Connection to the DB(DB connection objects)
Dim strConn As String =
"server=(local) ;database=North wind;integrated security=true;"
'Dim strConn As String =
"server=(local) ;database=pubs; trusted_connect ion=true;"

Dim objConn As New SqlConnection(s trConn)

'Created a Dataset to fill in the Data
Dim objDS As New DataSet

Dim daSuppliers As New SqlDataAdapter( "SELECT CompanyName,Sup plierID
FROM Suppliers", objConn)
Dim daProducts As New SqlDataAdapter( "SELECT ProductName, ProductID,
SupplierID FROM Products", objConn)

'Filled in the Data and close connections
'daSuppliers is the DataAdapter
daSuppliers.Fil l(objDS, "dtSupplier s")
daProducts.Fill (objDS, "dtProducts ")

'daSuppliers.Fi ll(objDS)
'daProducts.Fil l(objDS)
objConn.Close()

'A relation is created here because the Dataset has more than one
Datatable (there must be a common field in both
' to define the Parent Child relationship. In this is the SupplierID
objDS.Relations .Add("SuppToPro d", _
objDS.Tables("d tSuppliers").Co lumns("Supplier ID"), _
objDS.Tables("d tProducts").Col umns("SupplierI D"))
'Created TreeView datatypes
Dim nodeSupp, nodeProd As TreeNode
Dim rowSupp, rowProd As DataRow
'Loop through the datasets and populate the TreeView
For Each rowSupp In objDS.Tables("d tSuppliers").Ro ws

nodeSupp = New TreeNode

nodeSupp.Text = rowSupp("Compan yName")

nodeSupp.ID = rowSupp("Suppli erID")

TreeView1.Nodes .Add(nodeSupp)

'Loop through SuppToProd which is a Datatable
For Each rowProd In rowSupp.GetChil dRows("SuppToPr od")

nodeProd = New TreeNode

nodeProd.Text = rowProd("Produc tName")

'nodeProd.Text = <a href ="">" & rowProd("Produc tName")
&"</a>
'<a href=""offers.a sp?catID=" & rsCat("ServID") & """>" &
rsCat("ServiceN ame") & "</a>

nodeProd.ID = rowProd("Produc tID")

nodeSupp.Nodes. Add(nodeProd)

Next

Next

'cleaned up to save server resources

objDS.Dispose()

daSuppliers.Dis pose()

daProducts.Disp ose()

objConn.Close()

objConn.Dispose ()
End sub
Nov 18 '05 #1
0 1194

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
11515
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
3
12163
by: Ian | last post by:
Hi, I've been trying to create a listview and treeview with icons. You would think it's a pretty straight forward task. API documentation states you simply assign an ImageList - that's been populated either using VS.NET (my method) or programatically. I assigned the imagelist to the small icons in the listview. Even VS.NET has been satisfied with what I'm doing as it shows the listitems/treenodes with icons. As soon as I build/run...
4
1368
by: Danny | last post by:
I have installed Internet Web Controls locally in my machine, and in our server. I also added them into the toolbox tab in my Visual Interdev and on design layout, I can see the treeview object appears, but not when I run the page from Internet Explorer (means page is accessed in our server). Any ideas how to make this treeview recognized in the server? Thanks in advance,
1
2186
by: naijacoder naijacoder | last post by:
Hi Guys, I have an application below that is treeview menu populated from the database which works with asp.net webmatrix.But when i put it into code behind in Visual Studio.Net it gives the errors "TreeNode Not defined" "name TreeeView1 not defined" Can anybody tell me what 'm doing wrong? Sub Page_load(Sender As Object, E As EventArgs)
2
3856
by: Dave Wurtz | last post by:
All, I have a treeview on my form that has a lot of nodes on it. I would like to populate this treeview on another thread so my form will still paint while it is being populated. I have looked at the Backgroundworker object (and dragged one onto my form) and several other newsgroup threads. What I don't understand is that I can't access the treeview control in the sub that is handling the DoWork event (I get the error that I can't...
3
3102
by: edamron | last post by:
I am writing my first VB.Net program and have come across an interesting problem. My department generates large volumes of documents. By law we are required to keep the documents for a specific period of time based on several factors. The IT department has been asked to develop a program to assist in archiving the older documents. We have a stored procedure that returns the docket numbers to the cases that may have documents which are...
3
2248
by: Shawn | last post by:
Hi. I'm working with the TreeView control in my ASP.NET 1.1 application. I have a problem I haven't been able to figure out. When I click on a node (not expand), whether it's a parent node, a child node or a leaf node then a DataGrid is populated based on the node's ID property. If I expand a node then the DataGrid is not populated. This works fine. The problem is that this doesn't work if I collapse the tree. If I collapse the tree...
0
1293
by: Erland | last post by:
Hello all, I have just installed visual studio .net 2005 and started developing programs in asp.net 2.0. I have a scenerio where I have to populate treeview child nodes based on the entries being entered in textbox,but there is this thing I need to consider. Values in treeview nodes should be populated as nodes, all child nodes in this case, as soon as vales are being entered in textbox. That is to say, if I enter H in textbox then H...
1
4917
by: doemon | last post by:
Hi, I'm working on a pagination control and I need to dynamically rerender a treeview to display the next set of nodes depending on which page we're on. For example, page 1 will dispaly only nodes 1 to 10, but when the user clicks , the tree will display nodes 11 to 20. Page 1 will is loaded when the page that contains the ascx (parent of the treeview) is loaded. This is all cool. The treeview displays correctly. When I click the ...
0
8203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8711
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8642
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8368
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7203
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5576
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2630
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.