Using RadEditor with FileExplorer

2 posts, 0 answers
  1. mbd
    mbd avatar
    21 posts
    Member since:
    Jul 2007

    Posted 30 Dec 2009 Link to this post

    I've been experimenting with the FileExplorer, specifically connecting the FileExplorer to a SQL DB based on this article. So far, this solution seems to be a fit for my current needs. But, I'd like to see if I can extend the functionality so that when certain files are opened they are opened in a RadEditor (or other text editing control - but I'd prefer a RadEditor). For example, I want to be able to edit a text file (.xml, .txt, etc...) and ultimately save the changes.

    I believe the above example relies on a DBContentProvider as well as a handler, which I'm not yet quite grasping, and I suspect this might effect how a RadEditor solution is implemented. So, I'm hoping someone can help me solve my objective.

    I'd also like to ask for suggestions on learning resources or the like where I can learn more about what's going on here. I know the code here says a lot but there's much of it that is still way over my head. I'm hoping for something (book, video, etc...) that "holds my hand" as it explains the ins and outs of what's going on. Perhaps a bit much to ask for but I thought I'd throw it out there.

    Many thanks,
  2. Fiko
    Fiko avatar
    1406 posts

    Posted 04 Jan 2010 Link to this post

    Hello Mbd,

    In order to implement the desired behavior I recommend you follow these steps:
    • Attach a handler to the OnClientFileOpen event of the RadFileExplorer
    • Cancel opening of the default RadWindow (args.set_cancel(true)) and get the path to the opened file (args.get_path()) as shown in this example
    • I recommend you wrap the RadEditor control in a RadAjaxPanel (or use RadAjaxManager)
    • Please check this articles for more information.
    • Read the content of the file in the AjaxRequest server-side handler by using the passed path and assign its content to the Content property of the RadEditor content. 
    • Use the approach shown in this online demo in order to load content from DataBase to the RadEditor and store the content from the RadEditor to DataBase.

    More details about the implementing a FileBrowserContentProvider can be found in this article.
    I hope this helps.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top