Custom Content Provider not selecting

4 posts, 0 answers
  1. Erik Schindeldecker
    Erik Schindeldecker avatar
    6 posts
    Member since:
    Apr 2008

    Posted 22 Jul 2009 Link to this post

    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
  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 27 Jul 2009 Link to this post

    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.
  3. Erik Schindeldecker
    Erik Schindeldecker avatar
    6 posts
    Member since:
    Apr 2008

    Posted 27 Jul 2009 Link to this post

    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
  4. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 29 Jul 2009 Link to this post

    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.
Back to Top