This is a migrated thread and some comments may be shown as answers.

Operator '=' Not Defined using FindNodeByValue Method

1 Answer 80 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 26 Jan 2009, 02:29 PM
I have a page with a RadTreeView control.  I'm trying to populate the control based on data in a SQL database.  

When I try to use the FindNodeByValue Method, I get an error stating "Operator '=' is not defined for types 'Telerik.Web.UI.RadTreeNode' and 'Telerik.Web.UI.RadTreeNode'". 

I have looked at the examples for "Finding Nodes at Runtime" and "Turorial: Finding Nodes"...from what I am reading, this should work. 

What am I doing wrong?

Public

 

Sub LoadAttendeesTreeView(ByVal p_iSchdID As Integer)
Try
    ' Create DataSet & DataTables
    Dim ds As New DataSet
    Dim dtDepartment As DataTable = TrainingData.GetDepartments
    Dim dtEmployees As DataTable = TrainingData.GetAttendees(p_iSchdID)
    Dim curDept As Integer = 0

    ' Add the DataTables to the DataSet
    ds.Tables.Add(dtDepartment)
    ds.Tables.Add(dtEmployees)
    ' Create the data relationship
    ds.Relations.Add("RelDepartment", ds.Tables(0).Columns("DEPARTMENT"), ds.Tables(1).Columns("eca_emply_dpt_id"))

    For
Each deptRow As DataRow In ds.Tables(0).Rows
        curDept =
CType(deptRow("DEPARTMENT").ToString, Integer)
        Dim deptTESTNode As RadTreeNode = Me.tvAttendees.FindNodeByValue(curDept.ToString())
        ' GETTING ERROR ON LINE BELOW...
        If deptTESTNode = Nothing Then
            ' Create a root node for the department
            Dim deptNode As RadTreeNode = New RadTreeNode(deptRow("DEPT_NAME").ToString(), deptRow("DEPARTMENT").ToString())
            ' Add the node to the Tree View Control
            tvAttendees.Nodes.Add(deptNode)
        End If
    Next

    tvAttendees.DataBind()

Catch ex As Exception
    Dim rethrow As Boolean = ExceptionPolicy.HandleException(ex, "General Exception")
End Try

End Sub

1 Answer, 1 is accepted

Sort by
0
William
Top achievements
Rank 1
answered on 26 Jan 2009, 03:42 PM
Not sure what the problem is, but instead of using = or <>, I put... If Not (attndNode Is Nothing) Then  ...then it started working.
Tags
TreeView
Asked by
William
Top achievements
Rank 1
Answers by
William
Top achievements
Rank 1
Share this question
or