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

Custom Content Provider not selecting

3 Answers 173 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Erik Schindeldecker
Top achievements
Rank 1
Erik Schindeldecker asked on 22 Jul 2009, 01:09 PM
Good Morning,
I have modified the Telerik demo outlining a customer ContentProvider for the FileExplorer to only display files with a ".pdf" extension. However, the modified demo code is not properly selecting these files, returning everything in the assigned InitialPath, including folders.

Code Behind:
PageLoad:

 

Dim path As String

 

 

If upsRadTreeView.SelectedValue = Nothing Then

 

path = Page.ResolveUrl(

"~/CustomerData/" & Profile.CustomerNumber.ToString)

 

 

Else

 

path = Page.ResolveUrl(

"~/CustomerData/" & Profile.CustomerNumber.ToString & "/UPSData/" & upsRadTreeView.SelectedNode.Value.ToString)

 

 

End If

 

 

Dim paths As String() = {path}

 

documentsRadFileExplorer.InitialPath = path

documentsRadFileExplorer.Configuration.UploadPaths = paths

documentsRadFileExplorer.Configuration.ViewPaths = paths

documentsRadFileExplorer.Configuration.ContentProviderTypeName =

GetType(CustomProvider).AssemblyQualifiedName

 

Public

 

Class CustomProvider

 

 

Inherits FileSystemContentProvider

 

 

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 DirectoryItem

 

 

Dim baseDirectory As DirectoryItem = MyBase.ResolveDirectory(path)

 

 

Dim files As New List(Of FileItem)()

 

 

' Filter the files

 

 

 

 

 

For Each file As FileItem In baseDirectory.Files

 

 

If file.Extension = ".pdf" Then

 

 

 

 

files.Add(file)

 

End If

 

 

 

 

 

Next

 

 

 

 

 

Dim newDirectory As New DirectoryItem(baseDirectory.Name, baseDirectory.Location, baseDirectory.FullPath, baseDirectory.Tag, baseDirectory.Permissions, files.ToArray(), _

 

baseDirectory.Directories)

 

Return newDirectory

 

 

End Function

 

 

End

 

Class

 


Please advise.

Thanks,
Erik

3 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 27 Jul 2009, 11:31 AM
Hi Erik,

I believe that this KB will be of help.

Regards,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Erik Schindeldecker
Top achievements
Rank 1
answered on 27 Jul 2009, 03:09 PM
Good Morning,
This is the article I used as a reference which is not properly selecting. The modified code is listed in the initial post. Please advise.
Thanks,
Erik
0
Fiko
Telerik team
answered on 29 Jul 2009, 12:09 PM
Hello Erik,

I reworked the project in the demo in order to filter the .PDF files only and attached it to the thread. Could you please check it and in case that you still experience problems implementing the approach from the KB, please open a new support ticket and send me a runnable project that reproduces the issue. I will rework it to filter the .pdf files and send it back.

All the best,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
FileExplorer
Asked by
Erik Schindeldecker
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Erik Schindeldecker
Top achievements
Rank 1
Share this question
or