Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

Editor / Custom File Dialogs Content Provider

   
  
 
 
   

  • Database File Provider

    This example demonstrates the implementation of a custom FileBrowserContentProvider, using a SQL database as a file source. If you have installed the RadControls demo, the DBContentProvider class is available in the App_Code\Editor\ folder of the demo project or in this code library.

    Custom FileBrowserContentProvider implementation allows using virtually any type of file sources for the FileBrowser dialogs (Image Manager, DocumentManager, Media Manager, Flash Manager, Template Manager):

    • Database
    • Custom role-based CMS system
    • Web service
    • Applications which use URL Rewriters
    The DBFileBrowserContentProvider class inherits the abstract Telerik.Web.UI.Widgets.FileBrowserContentProvider class and implements its abstract members:
    • ResolveRootDirectoryAsTree- Called in order to load all subfolders of the passed as parameter folder
    • ResolveDirectory - Called in order to load all files of the passed as parameter folder
    • StoreFile - called to save an uploaded file to the storage
    • DeleteFile - called when user deletes a file
    • DeleteDirectory - called when user deletes a directory
    • CreateDirectory - called when user creates a directory
    • CanCreateDirectory - a readonly property, which value identifies if the New Directory icon will exist in the FileBrowser
    • GetFile - used in two cases: 1) to identify if a file with the same name exists in the same path when uploading a file; 2) when creating a thumbnail used to get the original image content
    • StoreBitmap - used to save a newly created bitmap to the storage
    • GetFileName - used to return the name of a file with given URL
    • GetPath - used to return the path of an item (file or directory) with given URL

    DBFileBrowserContentProvider uses a helper DataServer class, designed to handle the database operation functions.

    The file content is stored in the database and is served by the content-streamer Handler.ashx file.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Theme="Default" Language="c#" CodeFile="DefaultCS.aspx.cs" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Editor.DBFileBrowserContentProvider.DefaultCS" %>

    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <qsf:HeadTag ID="Headtag1" runat="server" />
    </head>
    <body class="BODY">
        <form runat="server" id="mainForm" method="post">
            <qsf:Header ID="Header1" runat="server" NavigationLanguage="c#" />
            <telerik:RadScriptManager ID="ScriptManager1" runat="server" />
            <telerik:RadEditor ID="RadEditor1" runat="server" ToolsFile="./DBFileBrowserContentProvider.xml">
                <Content>
                 <img alt="product logo" src="../../Img/productLogoLight.gif" />is the successor of the well known industry standard Editor for ASP.NET. The tight integration with ASP.NET AJAX and the powerful new capabilities make Telerik's WYSIWYG Editor a flexible and lightweight component, turning it into the fastest loading Web Editor. Among the hottest features are:
                    <ul>
                    <li><em>Single-file, drag-and-drop deployment</em></li>
                    <li><em>Built on top of ASP.NET AJAX</em></li>
                    <li><em>Unmatched loading speed with new semantic rendering </em></li>
                    <li><em>Full keyboard accessibility</em></li>
                    <li><em>Flexible Skinning mechanism</em></li>
                    <li><em>Simplified and intuitive toolbar configuration</em></li>
                    <li><em>Out-of-the-box XHTML-enabled output</em></li>
                    </ul>
                </Content>
            </telerik:RadEditor>
            <qsf:Footer runat="server" ID="Footer1" />
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451