ASP.NET Integration

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

(Created page with '== ASP.NET integration == The ASP.NET integration method might be useful if you haven't worked with JavaScript before or the JavaScript integration seems to be too complicated. …')
 
Line 3: Line 3:
 
The ASP.NET integration method might be useful if you haven't worked with JavaScript before or the JavaScript integration seems to be too complicated.
 
The ASP.NET integration method might be useful if you haven't worked with JavaScript before or the JavaScript integration seems to be too complicated.
  
=== Step 1: Loading CKFinder ===
+
==== Step1: Register an Assembly ====
 +
Register an Assembly at the top of your ASP.NET source page:
 +
<source lang=asp>
 +
<%@ Register Assembly="CKFinder" Namespace="CKFinder" TagPrefix="CKFinder" %>
 +
</source>
  
To load CKFinder, we need to include a CKFinder class definition first.
+
==== Step2: Add CKFinder tag ====
 +
Add the CKFinder tag inside the <body> element:
  
Supposing that you have [[CKFinder_2.x/Developers_Guide/ASP.NET/Installation|installed]] CKFinder at the "ckfinder" directory at the root of your web site, here you have an example:  
+
<source lang=asp>
 +
<CKFinder:FileBrowser ID="FileBrowser1" BasePath="/ckfinder/" Width="800" runat="server"></CKFinder:FileBrowser>
 +
</source>
  
<source language="php">
+
For a full working examples please refer to the "'''_samples'''" directory. Note that you must copy the CKFinder.dll file to your "bin" directory or make a reference to it in your Visual Studio project.
<?php
 
// Make sure you're using correct path here
 
require_once 'ckfinder/ckfinder.php';
 
?>
 
</source>
 
With the above file loaded, the CKFinder class is ready to be used.  
 
 
 
=== Step 2: Creating an Application Instance  ===
 
 
 
Next thing to do, to have the CKFinder up & running, is creating an application instance:
 
<source lang="php">
 
<?php
 
$finder = new CKFinder();
 
$finder->BasePath = '/ckfinder/';
 
$finder->Create();
 
?>
 
</source>
 
(put this code anywhere inside of the <code><body></code> tag). For an example please check the standalone sample distributed with CKFinder (_samples/php/standalone.php).
 
  
 
{{CKFinder_2.x V1 Integration Properties}}
 
{{CKFinder_2.x V1 Integration Properties}}
 
{{#CUSTOMTITLE:ASP.NET Integration}}
 
{{#CUSTOMTITLE:ASP.NET Integration}}

Revision as of 11:18, 18 May 2010

ASP.NET integration

The ASP.NET integration method might be useful if you haven't worked with JavaScript before or the JavaScript integration seems to be too complicated.

Step1: Register an Assembly

Register an Assembly at the top of your ASP.NET source page:

<%@ Register Assembly="CKFinder" Namespace="CKFinder" TagPrefix="CKFinder" %>

Step2: Add CKFinder tag

Add the CKFinder tag inside the <body> element:

<CKFinder:FileBrowser ID="FileBrowser1" BasePath="/ckfinder/" Width="800" runat="server"></CKFinder:FileBrowser>

For a full working examples please refer to the "_samples" directory. Note that you must copy the CKFinder.dll file to your "bin" directory or make a reference to it in your Visual Studio project.

Properties

The following properties are available in the CKFinder object:

  • BasePath - The URL path for the installation folder of CKFinder. Default value: "/ckfinder/".
  • Width - The CKFinder width (for example: 600, '80%'). Default value: "100%".
  • Height - The CKFinder height (for example: 500, '100%'). Default value: 400.
  • SelectFunction - An optional function to be called when the user selects a file in CKFinder.
  • SelectFunctionData - An optional argument of type string that will be passed to the "SelectFunction". Please refer to the js/popups.html file for a usage example.
  • SelectThumbnailFunction - An optional function to be called when the user selects a thumbnail in CKFinder. Default value: "SelectFunction" (if "SelectFunction" is set).
  • SelectThumbnailFunctionData - An optional argument of type string that will be passed to the "SelectThumbnailFunction".
  • DisableThumbnailSelection - If set to true, "Select thumbnail" item will not appear in the context menu. Default value: false.
  • ResourceType - Resource type to display. By default CKFinder displays all available resource types. If ResourceType property is set, CKFinder will display only specified resource type (e.g. "Files", "Images").
  • StartupPath - Resource Type and the name of the startup folder, separated with a colon (for example: "Files:/", "Images:/cars/"). If defined, CKFinder will open the selected folder automatically.
  • StartupFolderExpanded - Used only when "StartupPath" is set. If set to true, the initial folder will be opened automatically on startup.
  • RememberLastFolder - If set to true, CKFinder will remember the last used folder in a cookie. In some cases, it may be required to store the name of last used folder in separate cookies for different CKFinder instances, in such case, assign the "Id" property (explained below). Default value: true.
  • Id - Used to identify the CKFinder object, optional. If set, the "Id" variable will be passed to the server connector on each request. When "RememberLastFolder" is enabled and the "Id" is set, CKFinder will remember the last directory in a separate cookie.
  • ClassName - The name of the CSS class rule assigned to the CKFinder frame. Default value: "CKFinderFrame".