Hello,
I am re-writing a visual basic .net application(vis ual studio 2003) in an
asp.net application(vis ual studio 2005). The vb.net application relied on a
treeview and hence, treenodes. The treeview and treenode class in asp.net
is limited compared to vb.net's. In vb.net, the treenode had a nextnode
property which was equivalent to finding the next sibling of the treenode.
asp.net's treenode has a child property and a parent property. Any ideas on
how to determine the sibling of a treenode in asp.net's treenode class? I
am looking for the nextnode of the treeview.select ednode.
thanks. 3 4040
There is no next pointer, you will need to find the current node and then
iterate its collection of child nodes. The effect is the same, different
perspective.
--
_______________ _________
Warm regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"tanya foster" <ju*******@yaho o.com> wrote in message
news:31******** *************** *******@ureader .com... Hello, I am re-writing a visual basic .net application(vis ual studio 2003) in an asp.net application(vis ual studio 2005). The vb.net application relied on a treeview and hence, treenodes. The treeview and treenode class in asp.net is limited compared to vb.net's. In vb.net, the treenode had a nextnode property which was equivalent to finding the next sibling of the treenode. asp.net's treenode has a child property and a parent property. Any ideas on how to determine the sibling of a treenode in asp.net's treenode class? I am looking for the nextnode of the treeview.select ednode. thanks.
Alvin,
Sounds good but I am not visualizing it completely. Getting the
currentnode is easy as in treeview.select ednode. If I iterate through the
children of treeview.select ednode, then I am not getting a sibling of the
current node but i would be going after its children. There is a "child"
and a "parent" property available. I want the sibling or nextnode treenode.
Do you mean to get the parent of the currentnode and then iterate through
its children? I am sorry I don't quite understand but would love to.
Thanks Alvin for your help.
Here is my code which might help another asp.net developer or anyone else
when they are trying to get to the sibling treenodes or nextnodes in system.
web.ui.webcontr ols.treeview or treenode classes.
Here is an example of the treeview structure used(I am displaying it as xml
though)
.....
<material>
<partnumber>123 45</partnumber>
<description> 5 feet long pipe</description>
<units>10</units>
<type>stocked </type>
</material>
<material>
<partnumber>888 8</partnumber>
<description>ma chine saw and drill</description>
<units>2</units>
<type>on order</type>
</material>
....
When the user selects the partnumber to edit, after I validate that the new
partnumber exists in a table, I want to update the description treenode with
the matching description from the same table. I do not allow the user to
edit the description treenode.
The function below(written in .NET Framework version 2.0 asp.net) receives a
string and updates the description treenode of the partnumber the user
selected to edit.
TreeViewForXml is a system.web.ui.w ebcontrols.tree view
Assumption #1: TreeViewForXml. SelectedNode was a partnumber changed to a
valid new partnumber
Assumption #2: When the treeview was populated, the treenode.value field
was populated with the name of the xml element or xml attribute
Private Function UpdateDescripti onTreeNode(ByVa l NewDescription As String)
As Boolean
Dim NodeOfInterest As TreeNode
Dim k As Integer
Dim FoundDescriptio nTreeNode As Boolean
FoundDescriptio nTreeNode = False
'get the parent node of the selected node
NodeOfInterest = TreeViewForXml. SelectedNode.Pa rent
'now parse through the children nodes to locate selectednode's sibling
that contains description
If Not (NodeOfInterest Is Nothing) And NodeOfInterest. ChildNodes.Coun t >
0 Then
For k = 0 To NodeOfInterest. ChildNodes.Coun t - 1
If NodeOfInterest. ChildNodes(k).V alue = "descriptio n" Then
NodeOfInterest. ChildNodes(k).T ext = NewDescription
FoundDescriptio nTreeNode = True
End If
Next
End If
Return FoundDescriptio nTreeNode
End Function
I do hope the asp.net team SOON implements the nextnode property just like
in the System.Windows. Forms.treenode class.
Thanks for your suggestions and clarifications Alvin. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hai Nguyen |
last post by:
I'm learning C sharp and do not like vb much. I'm creatiing a wepage using
panel to test myself. I tried to use these code below, which is written in
VB, and to transform them to c sharp but I got hard time to understand vb
syntax. I don't know if anyone in here can point out which is the equivalent
object used in c sharp.
Translate these two lines to C sharp:
Sub Next_Click(Sender As Object, e As EventArgs)
Select Case...
|
by: Dean L. Howen |
last post by:
Hi,
I want to add some attributes to TreeNode, so I create a new class MyNode
that inheritance from System.Windows.Forms.TreeNode,
I want to TreeView use MyNode instead of TreeNode, so I can manipulate with
new attributes
How can? Please give me some ideas,
Thanks.
Because the TreeNode doesn't have Value Property which contents value behind
|
by: The Kiddie |
last post by:
Hi Guys,
I am doing some work with a treenode and I want to record the
selected item, and it may change while the user is performing some
tasks and I need to know which one was originally selected.
I want to create a property which will store the selected
TreeNode, and I can refer back to that when it is time to make the
changes. However I get a stack overflow error when I assign to the
propery. Here's the code
private TreeNode...
|
by: Mark Goldin |
last post by:
Here is an ASP page:
<%@ Register TagPrefix="mytree" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<%@ import namespace="Microsoft.Web.UI.WebControls"%>
<html>
<head>
</head>
<body>
<form runat="server">
<mytree:treeview runat="server" id="oTree" treenodesrc="aspsites.XML"
|
by: Turban |
last post by:
When I attempt to run the following code:
protected void NavigationTreeView_TreeNodePopulate(object sender,
TreeNodeEventArgs e) {
TreeNode tn1 = new TreeNode("node1","node1");
TreeNode tn2 = new TreeNode("node2", "node2");
TreeNode newNode = new TreeNode("add me to both nodes", "add me to
both nodes");
e.Node.ChildNodes.Add(tn1);
e.Node.ChildNodes.Add(tn2);
| |
by: Alan T |
last post by:
I am using VS 2005 and just wonder why I don't have this method?
|
by: John Faris |
last post by:
Hi all.
I have a class that inherits from TreeNode and adds a generic property,
NodeObject. Then I have several other classes that inherit from this class
and specify the type of NodeObject as below:-
public class BaseNode<T: TreeNode
{
private T _nodeObject;
public T NodeObject
|
by: celoftis |
last post by:
Using VS2005 ASP.NET 2.0, VB code behind:
I have a windows forms based application that I need to port to the
web. One of the major components of my windows forms based application
is a TreeView inside a slider object (allows users to resize the
TreeView during real-time).
Is there an equivalent ASP.NET (or AJAX.NET) control that will give
similar functionality to the windows forms splitter?
I'm aware of the following possibilities:
|
by: Karl Rhodes |
last post by:
Hi all...
Perhaps I'm not going about this the right way, but I wondered if
anyone can help?
I have a treeview which populates from a datatable using a parent/
child relationship. It stores a company/branch hierarchical structure
and show areas/regions/branches etc by name in it's nodes.
What I need to be able to do is select a node (by clicking on the
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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();...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |