I want to modify the EditorDialogs that I can find here : C:\Program Files\Telerik\RadControls for ASP.NET AJAX Q2 2010\EditorDialogs
Specifically, I need to change the RadFileExplorer1.Configuration.ContentProviderTypeName in the FileBrowser dialog, so that when it looks for a file, it lists them from the database instead of from the file system.
So, I copied the ascx in the EditorDialogs folder of my project. It seems to work, because if I add "aaaa" in the control, for example, it shows in the resulting html.
However, no server side code seems to work, at all, ever, period. If I add server-side code, then add breakpoints, they do not load (can't reach breakpoint, symbols not loaded)
- I tried to add a Page_Load method : nothing happens, not even if I just try a simple "response.write".
- I tried "<%= "test" %>" somewhere in the usercontrol : nothing shows
- I switched the language of the controls to VB (my project is vb.net, but the controls are in c#), still no luck
- I re-created the control using a code-behind file, still nothing, with either vb or c#
So, any idea on how I can switch the ContentProvider of every FileBrowser of every RadEditor of the project ? (and there are a lot of editors in there...)
Thanks
8 Answers, 1 is accepted
You can see how to execute server code in the external dialogs of RadEditor in the following KB article: Displaying single upload control in the FileBrowser Upload manager.
However, it is not needed to modify the code of every dialog one by one. My suggestion is to see the following demo Custom File Dialogs Content Provider, which shows how to implement a custom content provider that will be applied to all file browser dialogs.
Kind regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Is there any way to say "every editor everywhere in the project shoud use this provider" ?
In addition, we should have a different provider for images and for documents. I understand it's possible by modifying the .DocumentManager.ContentProviderTypeName in addition to the ImageManager's one, but if I have to duplicate the code in every page that calls the editor, I think my head would explode.
Thanks !
You can configure multiple instances of RadEditor using ASP.NET Themes. You can put the code of the FileBrowserContent provider in a CS file in the App_Code VS folder so that it can be accessed by the different pages in the project.
All the best,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
I already knew that. But how would you put those lines in a theme ?
With
CType
(
Me
.FormViewArticle.FindControl(
"RadEditorAccroche"
), Telerik.Web.UI.RadEditor)
.ImageManager.ContentProviderTypeName =
GetType
(CMS.TelerikHelper.FileProvider).AssemblyQualifiedName
.ImageManager.ViewPaths =
New
String
() {
"ROOT/Images/Nature/Fruits"
,
"ROOT/Images/Nature/Animals"
}
.ImageManager.UploadPaths =
New
String
() {
"ROOT/Images/Nature/Fruits"
,
"ROOT/Images/Nature/Animals"
}
.ImageManager.DeletePaths =
New
String
() {
"ROOT/Images/Nature/Fruits"
,
"ROOT/Images/Nature/Animals"
}
End
With
Thanks
You can put only controls' declarations in a skin file of an ASP.NET theme, but not server code.
My idea is to declare RadEditor as follows in a skin file:
<
telerik:RadEditor
ID
=
"RadEditor1"
runat
=
"server"
>
<
ImageManager
ContentProviderTypeName
=
"CMS.TelerikHelper.FileProvider"
ViewPaths
=
"ROOT/Images/Nature/Fruits"
UploadPaths
=
"ROOT/Images/Nature/Fruits"
DeletePaths
=
"ROOT/Images/Nature/Fruits"
/>
</
telerik:RadEditor
>
and after that reference the Theme in all project aspx files through the web.config file, e.g.
<
configuration
>
<
system.web
>
<
pages
theme
=
"ThemeName"
/>
</
system.web
>
</
configuration
>
See this article for more information: How to: Apply ASP.NET Themes.
Kind regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Thanks for your answer.
Unfortunately, adding ContentProviderTypeName="CMS.TelerikHelper.FileProvider" doesn't seems to work : it throws an ArgumentNullException.
[ArgumentNullException: La valeur ne peut pas être null. Nom du paramètre : type] System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +7681290 Telerik.Web.UI.RadFileExplorer.InitContentProvider(String selectedUrl) +226 Telerik.Web.UI.RadFileExplorer.InitContentProvider() +138 Telerik.Web.UI.RadFileExplorer.get_ContentProvider() +24 Telerik.Web.UI.RadFileExplorer.BindExplorer() +48 Telerik.Web.UI.RadFileExplorer.OnLoad(EventArgs e) +255 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
It seems strange to me that it would work, since "GetType(CMS.TelerikHelper.FileProvider).AssemblyQualifiedName" returns a string like "Name.Space, Version=0.0.0.0, Culture=neutral, PublicKeyToken=abcd".
Thanks
Actually, you should set as a value the string returned by the GetType(CMS.TelerikHelper.FileProvider).AssemblyQualifiedName code, e.g.
ImageManager-ContentProviderTypeName="Name.Space, Version=0.0.0.0, Culture=neutral, PublicKeyToken=abcd"
For example:
<
telerik:RadEditor
ID
=
"RadEditor1"
runat
=
"server"
ToolsFile
=
"./DBFileBrowserContentProvider.xml"
ImageManager-ContentProviderTypeName
=
"Telerik.Web.Examples.DBContentProvider, App_Code.ejro_xsw, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
>
The above setting is tested with the following live demo: Custom File Dialogs Content Provider and it works.
All the best,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Now I just have to figure out how to actually implement the provider...
Thanks !