Treeview control in VS2003

C

CoreyMas

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.

Example


topnode
(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
names
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
Else
Dim LevelNameCombo As New StringBuilder
With LevelNameCombo
.Append(pma_keyrow("Level1Name").ToString)
.Append("/")
.Append(pma_keyrow("Level2Name").ToString)
.Append("/")
.Append(pma_keyrow("Level3Name").ToString)
.Append("/")
.Append(pma_keyrow("Level4Name").ToString)
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"
treePMAView.Nodes.Add(newpmanode)
End If
Dim KeyNode As New TreeNode
Dim KeyNameCombo As New StringBuilder
With KeyNameCombo
.Append("Location: ")
.Append(pma_keyrow("LocCode"))
.Append(spacebr11)
.Append("Centre: ")
.Append(pma_keyrow("PCCode"))
.Append(spacebr11)
.Append("Product: ")
.Append(pma_keyrow("ProdCode"))
.Append(spacebr11)
.Append("Breakdown: ")
.Append(pma_keyrow("BreCode"))
.Append(spacebr11)
.Append("Metric: ")
.Append(pma_keyrow("MetCode"))
.Append("<br>")
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
CssCollection("font-family:verdana;vertical-align:top;")
KeyNode.ExpandedImageUrl = "/GISWEB_DEV/GUI/IMAGES/key.gif"
newpmanode.Nodes.Add(KeyNode)
Dim dv As DataView
dv = New DataView(ds.Tables("AllDatakeyAttributes"),
"PMA_DatakeyId = '" & pma_keyrow("PMA_DatakeyId").ToString & "'", "",
DataViewRowState.CurrentRows)
Dim attrrow As DataRowView
Dim attrtext As String = ""
For Each attrrow In dv
Dim AttrNameCombo As New StringBuilder
With AttrNameCombo
.Append(attrrow("AttributeCodeValue"))
.Append("<br>")
End With
attrtext = attrtext & AttrNameCombo.ToString
Next
If dv.Count > 0 Then
Dim attrnode As New TreeNode
attrnode.SelectedImageUrl =
"/GISWEB_DEV/GUI/IMAGES/attributes.gif"
attrnode.ImageUrl = "/GISWEB_DEV/GUI/IMAGES/attributes.gif"
attrnode.ExpandedImageUrl =
"/GISWEB_DEV/GUI/IMAGES/attributes.gif"
attrnode.DefaultStyle = New
CssCollection("font-family:verdana;vertical-align:top;")
attrnode.Text = attrtext.Substring(0,
attrtext.ToString.Length - 4)
KeyNode.Nodes.Add(attrnode)
End If
prevlevel1 = pma_keyrow("Level1Name")
prevlevel2 = pma_keyrow("Level2Name")
prevlevel3 = pma_keyrow("Level3Name")
prevlevel4 = pma_keyrow("Level4Name")
Next
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

Corey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top