DataRowView ParentNodeId

2 posts, 0 answers
  1. Kjell
    Kjell avatar
    223 posts
    Member since:
    May 2011

    Posted 20 May 2015 Link to this post

    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.

  2. Dimitar
    Dimitar avatar
    437 posts

    Posted 25 May 2015 Link to this post


    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.

    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
Back to Top