RadGrid Navigation

6 posts, 0 answers
  1. Sivaprakas Subramanian
    Sivaprakas Subramanian avatar
    15 posts
    Member since:
    Nov 2009

    Posted 09 Apr 2011 Link to this post

    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
  2. Svett
    Admin
    Svett avatar
    728 posts

    Posted 13 Apr 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Sivaprakas Subramanian
    Sivaprakas Subramanian avatar
    15 posts
    Member since:
    Nov 2009

    Posted 17 Apr 2011 Link to this post

    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
  5. Svett
    Admin
    Svett avatar
    728 posts

    Posted 20 Apr 2011 Link to this post

    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
  6. Ganapathy
    Ganapathy avatar
    12 posts
    Member since:
    Aug 2012

    Posted 06 Aug 2013 Link to this post

    Hi Svett,

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

    Thank You
    Regards
    Ganapathy

  7. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 09 Aug 2013 Link to this post

    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 >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready