Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Treeview control in VS2003

Thread Tools

Treeview control in VS2003

Posts: n/a
Hello everyone,

I have downloaded and installed the IE Web controls for Microsoft and I am
using the Treeview control to display a simply hierarchy

However, I cannot seem to get the Image associated with the node to align
vertically (top) to the actual contents of the node.


(I want the Graphic here) line1 of middle node
line2 of middle node
(Graphic appears here) line3 of middle node
line4 of middle node
line5 of middle node
(I want the graphic here) Line1 of end node
(Graphic appears here) line2 of end node
line3 of end node

I am dynamically creating the nodes, and the code is as follows:

Public Sub PopulateDataTree(ByVal ds As DataSet)
Dim pma_keyrow As DataRow
Dim newpmanode As TreeNode
Dim spacebr11 As String = "<br>"
Dim prevlevel1, prevlevel2, prevlevel3, prevlevel4 As String
For Each pma_keyrow In ds.Tables("AllViewPMA").Rows
' Create the header row using the Level1, level2, level3, level4
If prevlevel1 = pma_keyrow("Level1Name") And prevlevel2 =
pma_keyrow("Level2Name") And prevlevel3 = pma_keyrow("Level3Name") And
prevlevel4 = pma_keyrow("Level4Name") Then
' do not add a new pma level node
Dim LevelNameCombo As New StringBuilder
With LevelNameCombo
End With
newpmanode = New TreeNode
newpmanode.Text = LevelNameCombo.ToString
newpmanode.SelectedImageUrl = "/GISWEB_DEV/GUI/IMAGES/pma.gif"
newpmanode.ImageUrl = "/GISWEB_DEV/GUI/IMAGES/pma.gif"
newpmanode.ExpandedImageUrl = "/GISWEB_DEV/GUI/IMAGES/pma.gif"
End If
Dim KeyNode As New TreeNode
Dim KeyNameCombo As New StringBuilder
With KeyNameCombo
.Append("Location: ")
.Append("Centre: ")
.Append("Product: ")
.Append("Breakdown: ")
.Append("Metric: ")
End With
KeyNode.Text = KeyNameCombo.ToString
KeyNode.SelectedImageUrl = "/GISWEB_DEV/GUI/IMAGES/key.gif"
KeyNode.ImageUrl = "/GISWEB_DEV/GUI/IMAGES/key.gif"
KeyNode.DefaultStyle = New
KeyNode.ExpandedImageUrl = "/GISWEB_DEV/GUI/IMAGES/key.gif"
Dim dv As DataView
dv = New DataView(ds.Tables("AllDatakeyAttributes"),
"PMA_DatakeyId = '" & pma_keyrow("PMA_DatakeyId").ToString & "'", "",
Dim attrrow As DataRowView
Dim attrtext As String = ""
For Each attrrow In dv
Dim AttrNameCombo As New StringBuilder
With AttrNameCombo
End With
attrtext = attrtext & AttrNameCombo.ToString
If dv.Count > 0 Then
Dim attrnode As New TreeNode
attrnode.SelectedImageUrl =
attrnode.ImageUrl = "/GISWEB_DEV/GUI/IMAGES/attributes.gif"
attrnode.ExpandedImageUrl =
attrnode.DefaultStyle = New
attrnode.Text = attrtext.Substring(0,
attrtext.ToString.Length - 4)
End If
prevlevel1 = pma_keyrow("Level1Name")
prevlevel2 = pma_keyrow("Level2Name")
prevlevel3 = pma_keyrow("Level3Name")
prevlevel4 = pma_keyrow("Level4Name")
End Sub

How can I programatically set the alignment of the <tr> for the node to
valign = top?

Basically if i knew how to get to the <tr> or <td> tags that is being
autogenerated by the control I could modify it with Valign = top which should
solve my problem. However How do i do this?

Thanks for all your help

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to access the Page from a TreeNode (treeview 's element) : addinga context menu to a treeview abargaddon ASP .Net Building Controls 0 01-17-2008 11:05 AM
ASP.NET 2.0 TreeView - Programatically Selecting A TreeView Node =?Utf-8?B?VHltYm93?= ASP .Net 2 01-10-2006 03:51 AM
Issue with a custom TreeView derived from the TreeView control Ionutz ASP .Net Web Controls 2 10-23-2005 03:23 PM
VS2003 Control Form Size Frank Bishop ASP .Net 1 02-04-2005 02:51 PM
TreeView not rendering nodes? Cacheing of a TreeView Per Salmi ASP .Net Web Controls 1 10-15-2003 01:15 PM