Custom File Provider

2 posts, 0 answers
  1. Matthew Mackay
    Matthew Mackay avatar
    7 posts
    Member since:
    May 2010

    Posted 02 Jun 2010 Link to this post

    How can I pass some arguments into the custom file system provider? The FileExplorer takes a TYPE but it instantiates the class on it's own... I need to be able to pass in arguments or one of our custom business objects so that it has a reference to where the data will be coming from..

    Also, how can I get a reference to that provider or to the current data tree from my page? I want to be able to persist from the explorer by serialization etc. I see that FileExplorer.TreeView.GetXML() and that's close but I need the one with ALL of the data (files and directories)

    Thanks
  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 08 Jun 2010 Link to this post

    Hi Matthew,

    In reference to your questions:
    • "How can I pass some arguments into the custom file system provider?"
      The current implementation of the ContentProvider model used with RadFileExplorer does not allow passing parameter directly to the content provider. In your case I recommend you to use a Session  state variable in order to pass parameters to the implemented FileBrowserContentProvider. Then you can access the session by using this code:
      object sessionVar = this.Context.Session["SessionVarName"];
    • "Also, how can I get a reference to that provider or to the current data tree from my page?"
      The FilebrowserContentPrvoder which is initialized by the RadFileExplorer control cannot be accessed, but if you need to use the features of that class, you can initialize it manually outside of the RadFileExpolorer control:
      Telerik.Web.UI.Widgets.FileSystemContentProvider provider = new Telerik.Web.UI.Widgets.FileSystemContentProvider(this.Context,
      serachPaterns, viewPaths,
      deletePaths,
      selectedUrl,
      selectedItemTag);

      Then you can use the newly initialized object to perform desired actions, like DeleteFile, CopyFile, etc.
    • "I want to be able to persist from the explorer by serialization etc"
      "I see that FileExplorer.TreeView.GetXML() and that's close but I need the one with ALL of the data (files and directories)"
      I am not quite sure what exactly do you need to achieve, but by design RadFileExplorer does not load all its data, but only the information about the visible folders and their immediate children (not all folders and files in the directory tree). The immediate children's information is required in order to determine whether to show or not the "+" sign next to the folders in the TreeView. When you click on a folder (Folder A for example) it will be expanded and then its immediate children (only one sub folder for example, named Folder B) will be shown. In this case the RadFileExplorer will get information about child folders of Folder B in order to determine whether to show or not the '+' sign.

    I hope this helps.

    Sincerely yours,
    Fiko
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top