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

DataRowView ParentNodeId

1 Answer 98 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Iron
Iron
Kjell asked on 20 May 2015, 07:51 AM

This work!

 

If (TryCast(e.Node.DataItem, DataRowView))("NodeId").ToString() = 3 Then
    e.Node.AllowDrag = False
End If

 

 This is not work

 

If (TryCast(e.Node.DataItem, DataRowView))("ParentNodeId").ToString() = 3 Then
    e.Node.AllowDrag = False
End If

Get: Exception Details: System.FormatException: Input string was not in a correct format.

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 25 May 2015, 07:48 AM
Hello,

It seems that the ParentNodeId data cannot be converted to integer and your comparison throws the exception. Check if that field contains some characters that cannot be parsed and trigger the exception. The following StackOverflow thread explains such a conversion issue.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TreeView
Asked by
Kjell
Top achievements
Rank 1
Iron
Iron
Answers by
Dimitar
Telerik team
Share this question
or