UI controls for ASP.NET AJAX, MVC, WPF,Silverlight, Windows 8 and Windows Phone
Cross-platform Mobile Development Toolwith cloud-based architecture
Everything you need to build sites andmobile apps with JavaScript and HTML5
One easy tool for Functional, Performance,Load and Mobile software testing
Everything for your online business - contentmanagement, ecommerce, emarketing
Simple and intuitive project managementand collaboration software
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 RadFileExplorer:
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.
Note that the EnableFileOpen property has been disabled for this example, because opening the handler.ashx in a new window always forces the browser to download the image, instead of displaying it.
<%@ Page Language="c#" CodeFile="DefaultCS.aspx.cs" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Editor.DBFileBrowserContentProvider.DefaultCS" %> <%@ 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> <title>ASP.NET FileExplorer Demo - Custom File Content Provider</title> <script src="scripts.js" type="text/javascript"></script> </head> <body> <form id="form1" runat="server"> <telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" /> <div class="qsf-ib" style="margin-right: 20px; vertical-align: top;"> Browse to an image and click to preview. <telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Width="500px" Height="300px" OnClientItemSelected="OnClientItemSelected" EnableOpenFile="false"> </telerik:RadFileExplorer> </div> <div class="qsf-ib" style="vertical-align: top;"> <fieldset style="width: 270px; height: 270px"> <legend>Preview</legend> <img id="pvwImage" src="/aspnet-ajax/Editor/Examples/DBFileBrowserContentProvider/Handler.ashx?path=Root%2fImages%2fNature%2fFruits%2f7191.JPG" alt="" style="display: none; margin: 10px; width: 250px; height: 225px;" /> </fieldset> </div> </form> </body> </html>