Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > GridView > visible area in gridview

Not answered visible area in gridview

Feed from this thread
  • yair avatar

    Posted on Jan 29, 2012 (permalink)

    Hello..
    I want to know how many rows there are in the visible area in gridview..
    how can I do that?

    this is for controlling load of rows.. to get better performance..
    I want to load 30 rows each scrolling..

    Reply

  • Svett Svett admin's avatar

    Posted on Jan 31, 2012 (permalink)

    Hello Yair,

    You can get the rows that are visible by accessing the VisualRows property of GridTableElement:

    public IEnumerable<GridViewDataRowInfo> GetVisibleDataRows()
    {
        foreach (GridRowElement rowElement in this.myRadGridView1.TableElement.VisualRows)
        {
            if (rowElement.RowInfo is GridViewDataRowInfo)
            {
                yield return rowElement.RowInfo as GridViewDataRowInfo;
            }
        }
    }

    I hope this helps.

    Regards,
    Svett
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

    Reply

  • yair avatar

    Posted on Jan 31, 2012 (permalink)

    thanks Svett

    i'm using vb.net.
    I tried to convert the code to vb.net but i couldn't..
    can you write it in vb.net?

    Reply

  • Svett Svett admin's avatar

    Posted on Feb 2, 2012 (permalink)

    Hi Yair,

    Here is the VB.NET version of the code snippet that I have sent you previously:

    Public Function GetVisibleDataRows() As IEnumerable(Of GridViewDataRowInfo)
        For Each rowElement As GridRowElement In Me.myRadGridView1.TableElement.VisualRows
            If TypeOf rowElement.RowInfo Is GridViewDataRowInfo Then
                yield Return TryCast(rowElement.RowInfo, GridViewDataRowInfo)
            End If
        Next
    End Function
    All the best,
    Svett
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

    Reply

  • yair avatar

    Posted on Feb 2, 2012 (permalink)

    it doesn't good.. I converted the c# code by Telerik converter tool too.. it doesn't work well..
    the converter dosn't know how to convert the code "yield"

    Reply

  • Svett Svett admin's avatar

    Posted on Feb 6, 2012 (permalink)

    Hi Yair,

    Here is a valid VB.NET version of my code snippet:

    Public Function GetVisibleDataRows() As List(Of GridViewDataRowInfo)
        Dim result As New List(Of GridViewDataRowInfo)()
     
        For Each rowElement As GridRowElement In Me.myRadGridView1.TableElement.VisualRows
            If TypeOf rowElement.RowInfo Is GridViewDataRowInfo Then
                result.Add(TryCast(rowElement.RowInfo, GridViewDataRowInfo))
            End If
        Next
     
        Return result
    End Function

    I hope this helps.

    Regards,
    Svett
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

    Reply

  • yair avatar

    Posted on Feb 7, 2012 (permalink)

    thanks Svett!!! it's perfect! :-) 

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > GridView > visible area in gridview
Related resources for "visible area in gridview"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]