Trying to limit the results that are returned to a FileExplorer and it works sporadically and quite possibly we are missing something. If a file exists for a Credit Union it will display as it should however if there isn't one found it will return all the records in that folder (which we do not want). After it shows all the files if I click the refresh button within the FileExplorer it will then show there are no results. There is only two possible outcomes:
if a file exists for that credit union, show the file
if does not exist, show no files
if a file exists for that credit union, show the file
if does not exist, show no files
Public Shared iASI_Num As Integer Public Shared Property GetAsiNum() As Integer Get Return iASI_Num End Get Set(ByVal value As Integer) iASI_Num = value End Set End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load End Sub Protected Function GetVisibleControls() As Telerik.Web.UI.FileExplorer.FileExplorerControls Dim explorerControls As Telerik.Web.UI.FileExplorer.FileExplorerControls = 0 explorerControls = explorerControls Or Telerik.Web.UI.FileExplorer.FileExplorerControls.AddressBox explorerControls = explorerControls Or Telerik.Web.UI.FileExplorer.FileExplorerControls.Grid explorerControls = explorerControls Or Telerik.Web.UI.FileExplorer.FileExplorerControls.ListView explorerControls = explorerControls Or Telerik.Web.UI.FileExplorer.FileExplorerControls.Toolbar explorerControls = explorerControls Or Telerik.Web.UI.FileExplorer.FileExplorerControls.TreeView explorerControls = explorerControls Or Telerik.Web.UI.FileExplorer.FileExplorerControls.ContextMenus Return explorerControls End Function Private Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender If Not String.IsNullOrEmpty(Session("ASI_Num")) Then If Session("asi_num") <> 0 Then iASI_Num = Session("ASI_Num") 'set properties according to configuration panel FileExplorer1.Configuration.SearchPatterns = New String() {"*.pdf"} FileExplorer1.VisibleControls = GetVisibleControls() FileExplorer1.EnableOpenFile = True FileExplorer1.DisplayUpFolderItem = False FileExplorer1.AllowPaging = False FileExplorer1.EnableCreateNewFolder = False FileExplorer1.Configuration.AllowFileExtensionRename = False FileExplorer1.Upload.InitialFileInputsCount = 1 FileExplorer1.Upload.MaxFileInputsCount = 1 If (FileExplorer1.VisibleControls And Telerik.Web.UI.FileExplorer.FileExplorerControls.Grid) = 0 Then FileExplorer1.ExplorerMode = Telerik.Web.UI.FileExplorer.FileExplorerMode.Thumbnails End If If (FileExplorer1.VisibleControls And Telerik.Web.UI.FileExplorer.FileExplorerControls.ListView) = 0 Then FileExplorer1.ExplorerMode = Telerik.Web.UI.FileExplorer.FileExplorerMode.[Default] End If FileExplorer1.Configuration.UploadPaths = New String() {"~/PDF/ECPay"} FileExplorer1.Configuration.DeletePaths = New String() {"~/PDF/ECPay"} '#region assign-provider_vb FileExplorer1.Configuration.ContentProviderTypeName = GetType(ExtendedFileProvider).AssemblyQualifiedName '#endregion End If End If End SubEnd ClassPublic Class ExtendedFileProvider Inherits Telerik.Web.UI.Widgets.FileSystemContentProvider Dim iAsi_Num As Integer = ECPayManagement.GetAsiNum 'constructor must be present when overriding a base content provider class 'you can leave it empty Public Sub New(ByVal context As HttpContext, ByVal searchPatterns As String(), ByVal viewPaths As String(), ByVal uploadPaths As String(), ByVal deletePaths As String(), ByVal selectedUrl As String, _ ByVal selectedItemTag As String) MyBase.New(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, _ selectedItemTag) End Sub Public Overloads Overrides Function ResolveDirectory(ByVal path As String) As Telerik.Web.UI.Widgets.DirectoryItem 'get the directory information Dim baseDirectory As Telerik.Web.UI.Widgets.DirectoryItem = MyBase.ResolveDirectory(path) 'remove files that we do not want to see Dim files As New System.Collections.Generic.List(Of Telerik.Web.UI.Widgets.FileItem)() For Each file As Telerik.Web.UI.Widgets.FileItem In baseDirectory.Files If IsFiltered(file.Name.ToString) Then files.Add(file) End If Next Dim newDirectory As New Telerik.Web.UI.Widgets.DirectoryItem(baseDirectory.Name, baseDirectory.Location, baseDirectory.FullPath, baseDirectory.Tag, baseDirectory.Permissions, files.ToArray(), _ baseDirectory.Directories) 'return the updated directory information Return newDirectory End Function Public Overrides Function StoreFile(file As Telerik.Web.UI.UploadedFile, path As String, name As String, ParamArray arguments As String()) As String Dim extension As String = name.Substring(name.LastIndexOf(".")) name = iAsi_Num & extension 'put here your logic for getting the client id Return MyBase.StoreFile(file, path, name) End Function Private Function IsFiltered(name As String) As Boolean If name.ToString = CStr(iAsi_Num & ".pdf") Then Return True End If ' else Return False End Function