This is a migrated thread and some comments may be shown as answers.

fileExplorer filter not working properly

1 Answer 46 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 03 Jul 2014, 05:43 PM
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

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 07 Jul 2014, 12:32 PM
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.

 
Tags
FileExplorer
Asked by
Kevin
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or