This is a migrated thread and some comments may be shown as answers.
RadGrid Navigation
5 Answers 109 Views
This is a migrated thread and some comments may be shown as answers.
Sivaprakas Subramanian
Top achievements
Rank 1
Sivaprakas Subramanian asked on 09 Apr 2011, 07:05 AM
Hi i navigate RadGrid view using following code

Private Sub DOCFirstDtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DOCFirstDtn.Click
     If DocumentsGV.Rows.Count > 0 Then
         DocumentsGV.Rows(0).IsSelected = True
         DocPreviousBtn.Enabled = False
         DocNextBtn.Enabled = True
     End If
 End Sub
 Private Sub DocLastBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DocLastBtn.Click
     If DocumentsGV.Rows.Count > 0 Then
         DocumentsGV.Rows(DocumentsGV.Rows.Count - 1).IsSelected = True
         DocNextBtn.Enabled = False
         DocPreviousBtn.Enabled = True
     End If
 End Sub
 Private Sub DocPreviousBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DocPreviousBtn.Click
     If DocumentsGV.Rows.Count > 0 Then
         Dim SelectedRowIndex As Integer = DocumentsGV.SelectedRows(0).Index
         If SelectedRowIndex = 1 Then
             DocPreviousBtn.Enabled = False
         Else
             DocPreviousBtn.Enabled = True
         End If
         DocNextBtn.Enabled = True
         DocumentsGV.Rows(SelectedRowIndex - 1).IsSelected = True
     End If
 End Sub
 Private Sub DocNextBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DocNextBtn.Click
     If DocumentsGV.Rows.Count > 0 Then
        
         Dim SelectedRowIndex As Integer = DocumentsGV.SelectedRows(0).Index
         Dim vvv As Integer = DocumentsGV.SelectedRows.Count
         If SelectedRowIndex = (DocumentsGV.Rows.Count - 2) Then
             DocNextBtn.Enabled = False
         Else
             DocNextBtn.Enabled = True
         End If
         DocPreviousBtn.Enabled = True
         DocumentsGV.Rows(SelectedRowIndex + 1).IsSelected = True
     End If
 End Sub

but if i group RadGrid then the Selected index of RadGrid does not change
if i change also still hold the previousSelected index
how to solve this

5 Answers, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 13 Apr 2011, 04:45 PM
Hi Sivaprakas Subramanian,

The described behavior is expected and by design. I do not recommend using an index to navigate through the rows, because it is not relevant when data operations such as grouping, sorting or filtering are applied. I suggest using the grid navigator. It allows going forward or backward in the rows collection. Please consider the code snippet below:

this.radGridView1.GridNavigator.SelectNextRow(1);
this.radGridView1.GridNavigator.SelectPreviousRow(1);

I hope this helps.

Greetings,

Svett
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Sivaprakas Subramanian
Top achievements
Rank 1
answered on 17 Apr 2011, 08:27 AM
hi svett
ur solution working fine
can u tell me how can i disable Previous and Next Button mean how can i know current row is Previous row of last row
0
Svett
Telerik team
answered on 20 Apr 2011, 11:46 AM
Hi Sivaprakas ,

You can use IsFirstRow and IsLastRow methods of GridNavigator:

this.radGridView1.GridNavigator.IsFirstRow(row);
this.radGridView1.GridNavigator.IsLastRow(row);

All the best,
Svett
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Ganapathy
Top achievements
Rank 1
answered on 06 Aug 2013, 05:29 PM
Hi Svett,

I cannot able to get/see GridNavigator property from the RadGrid control.

Thank You
Regards
Ganapathy

0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 09 Aug 2013, 03:03 PM
Hello Ganapathy,

Thank you for contacting Telerik Support.

RadGridView.GridNavigator property gets an instance of BaseGridNavigator or the instance that implements IGridNavigator interface.
The following code snippet demonstrates how to navigate the selected cell according to the attached picture.
private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'nwindDataSet.Products' table. You can move, or remove it, as needed.
            this.productsTableAdapter.Fill(this.nwindDataSet.Products);
 
            this.radGridView1.GridNavigator.SelectNextRow(3);
            this.radGridView1.GridNavigator.SelectNextColumn();
            this.radGridView1.GridNavigator.SelectNextColumn();
        }

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Asked by
Sivaprakas Subramanian
Top achievements
Rank 1
Answers by
Svett
Telerik team
Sivaprakas Subramanian
Top achievements
Rank 1
Ganapathy
Top achievements
Rank 1
Dess | Tech Support Engineer, Sr.
Telerik team
Share this question
or