Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

Treeview control in VS2003

 
 
CoreyMas
Guest
Posts: n/a
 
      04-01-2005
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
 
Reply With Quote
 
 
 
Reply

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



Advertisments