Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
310
Using WebDataTree As A File Browsing System
posted

I have a WebDataTree in my ASP.NET web application. I want to use it to show the files that users have uploaded to a SQL database. I have two tables in my database: Folders and Files. The Folders table has a FolderID, ParentID, Name. The Files table has a FileID, ParentID, Name. In both tables, the ParentID refers to the folder that contains the item, so a folder can belong to another folder. This is where my problem lies. I cannot figure out how to configure my WebHierarchicalDataSource to recursively relate folders inside of folders inside of folders etc. Can anyone help me set up my WebDataTree this way?

  • 15320
    Offline posted

    Hello Eric,

    Thank you for posting in our community.

    I'm currently looking into this matter and will keep you posted of any available information.

    At the meantime if you have any additional questions, please let me know.

    Sincerely,

    Tsanna

  • 29417
    Offline posted

     Hello Eric ,

     

    From what I gathered from your description you’ll need the Table with the Folders to be self-referencing ( since one folder may hold a reference to another folder) and also have a reference between the Folder and Files tables.

     

    You could use the WebHierarchicalDataSource control to build the views and the relations between those views.

     

    For example the self-referencing data relation would look similar to this:

                        <ig:DataRelation ParentDataViewID="FolderTable" ParentColumns="FolderID" ChildDataViewID="FolderTable" ChildColumns="ParentID" />

    The parent column will be the folder id and the child column will be the ParentID .

    The other reference between the folders and files would be between the FolderID of the FolderTable and the ParentID of the Files Table:

    <ig:DataRelation ParentDataViewID="FolderTable" ParentColumns="FolderID" ChildDataViewID="FilesTable" ChildColumns="ParentID" />

     

    I’ve attached an example with 2 data tables used as the data sources of the Views of the WebHierarchicalDataSource control.

    Please refer to it and let me know if you have any questions.

     

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer II

    Infragistics, Inc.

    http://www.infragistics.com/support

     

    FileBrowsingSystem_WDT.zip
  • 29417
    Offline posted

     Hello Eric,

     

    I’m just following up to see if you’ve been able to resolve your issue. If you have any questions or concerns or if you need further assistance please let me know.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

    http://www.infragistics.com/support