Gridview freezing UI

2 posts, 0 answers
  1. Spiffy Jones
    Spiffy Jones avatar
    3 posts
    Member since:
    Oct 2006

    Posted 09 Jul 2013 Link to this post

    I'm using a radgridview to display search results for metadata for files. The grid has 6 columns and for any search I try, whenever I'm adding results to the grid, the whole UI is freezing until the results are added.

    I've tried it with a background worker and adding the rows in the report progress event., but it still doing this.

    The grid is placed on a tabpage control.
  2. Anton
    Admin
    Anton avatar
    167 posts

    Posted 11 Jul 2013 Link to this post

    Hello Spiffy,

    Thank you for writing.

    The issue in your case appears due missing BeginUpdate and EndUpdate methods around your logic that inserts the rows into RadGridView. With this methods RadGridView suspends the updates after  each addition and performs them only once, whwn EndUpdate is called. Consider the following example:
    radgridMetadata.BeginUpdate()
    For inti = 0 To UBound(objRow)
        Dim rowInfo As New Telerik.WinControls.UI.GridViewDataRowInfo(Me.radgridMetadata.MasterView)
        rowInfo.Cells("colDocumentID").Value = objRow(inti).Item("Document_ID").ToString
        rowInfo.Tag = objRow(inti).Item("docType")
     
        If objRow(inti).Item("document_date").ToString <> "" Then
            rowInfo.Cells("colDateDocument").Value = CDate(objRow(inti).Item("Date_Document").ToString).ToShortDateString
        End If
        rowInfo.Cells("colTitle").Value = objRow(inti).Item("title").ToString
        rowInfo.Cells("colDocumentType").Value = objRow(inti).Item("document_type").ToString
        rowInfo.Cells("colHostReference").Value = objRow(inti).Item("host_reference").ToString
        rowInfo.Cells("colDescription").Value = objRow(inti).Item("description").ToString
     
        radgridMetadata.Rows.Add(rowInfo)
    Next
    radgridMetadata.EndUpdate()

    I hope this helps.

    Regards,
    Anton
    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