Click here to Skip to main content
15,891,787 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have to reorder a Telerik grid but is giving me the error in row1 = rdgComponentes.DataSource.[Select]([String].Format("Sequencia = '{0}'", key1.ToString()))(0)

Here is the code:
Dim upbtn As ImageButton = DirectCast(sender, ImageButton)
Dim item As GridDataItem = DirectCast(upbtn.NamingContainer, GridDataItem)
Dim index As Integer = item.ItemIndex
If index = 0 Then
    Return
End If
Dim movedItem As GridItem = TryCast(TryCast(rdgComponentes.MasterTableView.Controls(0), Table).Rows(index), GridItem)
Dim beforeItem As GridItem = TryCast(TryCast(rdgComponentes.MasterTableView.Controls(0), Table).Rows(index - 1), GridItem)
Dim key1 As Object = rdgComponentes.MasterTableView.DataKeyValues(index)("Sequencia")
Dim row1 As DataRow
row1 = rdgComponentes.DataSource.[Select]([String].Format("Sequencia = '{0}'", key1.ToString()))(0)
MoveDataRowUp(row1)
rdgComponentes.Rebind()


What I have tried:

i think that the problem is nne of the objects on that line is Nothing.
Posted
Updated 26-Aug-16 5:56am
v2

1 solution

You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.

The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia[^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]

The debugger is here to show you what your code is doing and your task is to compare with what it should do.
When the code don't do what is expected, you are close to a bug.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900