fileExplorer filter not working properly

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 03 Jul 2014 Link to this post

    I ma trying to filter the fileExplorer to show only uploads that I have put in the database.  If there are no files then I want it to say no files, which I see it can do.  So the following is my code, I pull the file names from the database and put into the filter method but the only thing that ever show up is the 1st file and nothing after this.  there could be 10 files in sql query but only 1st one shows.  I know its in my code but tried many variations but keep coming back to this becuase everything else breaks this version does not.  So how can I get the filter to show jus the files in the sql pull.  Thanks.

    Private Sub radFileExplorer_ExplorerPopulated(sender As Object, e As RadFileExplorerPopulatedEventArgs) Handles radExplorer.ExplorerPopulated
     
           'If HFPriorService.Value > "" Then
           sql = "Select strUrl from PriorServiceUpload where intPriorServiceId = " & HFPriorService.Value
     
           myDataTable = New DataTable
           myDataTable = getReader(sql)
     
           If myDataTable.Rows.Count > 0 Then
               If e.ControlName = "grid" Then
                   Dim items As List(Of FileBrowserItem) = e.List
                   Dim i As Integer = 0
                   For Each row As DataRow In myDataTable.Rows
                       While i < items.Count
                           If Not items(i).Name.Contains(row(0)) Then
                               items.Remove(items(i))
                           Else
                               i += 1
                           End If
                       End While
                   Next
               End If
           End If
           'End If
       End Sub
  2. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 07 Jul 2014 Link to this post

    Hi Kevin,

    I have just answered your other ticket on the subject - for convenience I will paste my answer here as well:

    Can you try moving the below hightlighted row into the for each statement and let me know how it goes?
    If e.ControlName = "grid" Then
        Dim items As List(Of FileBrowserItem) = e.List
        Dim i As Integer = 0
        For Each row As DataRow In myDataTable.Rows
            While i < items.Count
                If Not items(i).Name.Contains(row(0)) Then
                    items.Remove(items(i))
                Else
                    i += 1
                End If
            End While
        Next
    End If
    To:
    If e.ControlName = "grid" Then
        Dim items As List(Of FileBrowserItem) = e.List
        For Each row As DataRow In myDataTable.Rows
            Dim i As Integer = 0
            While i < items.Count
                If Not items(i).Name.Contains(row(0)) Then
                    items.Remove(items(i))
                Else
                    i += 1
                End If
            End While
        Next
    End If

    On a side note, I would like to kindly ask you to use just one support channel to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two threads instead of one.

    Regards,
    Vessy
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top