We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Move the rows in the grid

Hi, I'm having GDBG bounded to datasource. If the user selects one row, and click on "MoveUp" button on the form, the selected row should go one row up. I tried using CurrentCell.MoveUp(1) or (-1), but its changing the selection and not the actual row. Many thx for the help. Ram

3 Replies

AD Administrator Syncfusion Team April 24, 2003 02:18 PM UTC

What version of the grid dll's are you using? With 1.5.2.0, I just dropped a GridDataBoundGrid on a form, hooked it to a DataTable, and the below seems to work as expected. What are you doing differently? Can you attached a sample project showingthe problem?
Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        Me.gridDataBoundGrid1.CurrentCell.MoveUp(1)
    End Sub 'button1_Click


Private Sub button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button2.Click
        Me.gridDataBoundGrid1.CurrentCell.MoveDown(1)
    End Sub 'button2_Click



RA Ramu April 24, 2003 02:42 PM UTC

Hi Clay, Thx for u r response. Here is my sample appluication. Assume, I am having 10 rows in the grid bounded. If the user selects row number 3, and clicks moveup, the entire row contents should be moved to row 2 and the row 2 contents should be moved to row 3. same as move down. Thx in advance. Ram > What version of the grid dll's are you using? > > With 1.5.2.0, I just dropped a GridDataBoundGrid on a form, hooked it to a DataTable, and the below seems to work as expected. What are you doing differently? Can you attached a sample project showingthe problem? > >
> Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
>         Me.gridDataBoundGrid1.CurrentCell.MoveUp(1)
>     End Sub 'button1_Click
> 
> 
> Private Sub button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button2.Click
>         Me.gridDataBoundGrid1.CurrentCell.MoveDown(1)
>     End Sub 'button2_Click
> 
> 


AD Administrator Syncfusion Team April 24, 2003 03:09 PM UTC

The GridDataBoundGrid is just displaying the rows in the order as they are received from the datasource. There is no built-in mechanism to dynamically shuffle rows (unless you shuffle them in the datasource). If you populate a GridControl with your datatable, then you can explicitly move rows in this manner as the GridControl woul dhave its own copy of the data that it manages. One way you could try implement this functionality would be to override GridDataBoundGrid and GridModelDataBinder to get at QueryCellInfo and SaveCellInfo in the binder.

Loader.
Live Chat Icon For mobile
Up arrow icon