There is any project sample for using RadEditor into an MVC .NEt project ?
15 Answers, 1 is accepted
We are currently working on a full-blown MVC application using Telerik RadControls and will release it very soon.
In case you would like to see how to integrate the editor in particular, prior to the sample application's release - please let us know and we will prepare a sample page and post it here.
Sincerely yours,
Tervel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I am interested in this too. Could you post a sample of how to intergrate RadEditor into a sample ASP.NET MVC page?
Regards
Gpl
Please find project attached.
All the best,
Tervel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I am running both a normal asp.net site inside an MVC application (so it is an app - not website) and everything works great - except the dialogue boxes.
I have put the httpHandlers in the system.web section
<add path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Version=2008.2.826.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" |
validate="false" /> |
<add path="Telerik.Web.UI.SpellCheckHandler.axd" verb="*" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Version=2008.2.826.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" |
validate="false" /> |
<add name="Telerik_Web_UI_WebResource_axd" preCondition="integratedMode" verb="*" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Version=2008.2.826.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/> |
<add name="Telerik_Web_UI_DialogHandler_aspx" preCondition="integratedMode" verb="*" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Version=2008.2.826.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" /> |
because this was an asp.net form, rather than a view, I did not think I needed the:
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> |
<% using (Html.BeginForm("PostContent", "Home")) { %> |
<telerik:RadEditor runat="server" ID="RadEditor1" DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd"> |
</telerik:RadEditor> |
<input type="submit" value="Save" /> |
<%}%> |
Any ideas?
Are you getting 404 for the dialogs? If so Have you added an ignoreroute command in your global.asax?
here is how you do that: routes.IgnoreRoute("Telerik.Web.UI.DialogHandler.aspx");
As the dialog handlers dont exist as files on the disk, MVC will try to intercept the request and obviously fial to find a matching route.
Sorry if this is not the problem.
Gpl
So I added this in my Global.asax:
Public Class MvcApplication |
Inherits System.Web.HttpApplication |
Shared Sub RegisterRoutes(ByVal routes As RouteCollection) |
routes.IgnoreRoute("backoffice/*") |
routes.IgnoreRoute("{resource}.axd/{*pathInfo}") |
routes.IgnoreRoute("Telerik.Web.UI.DialogHandler.aspx") |
routes.MapRoute( _ |
"Version", _ |
"version/{versionID}", _ |
New With {.controller = "Version", .action = "Index", .versionID = "0"} _ |
) |
routes.MapRoute( _ |
"PageID2", _ |
"{FriendlyURL}", _ |
New With {.controller = "PageURL", .action = "index", .FriendlyURL = "Home"} _ |
) |
routes.MapRoute( _ |
"PageID", _ |
"{controller}/{pageID}", _ |
New With {.controller = "ID", .action = "index", .pageID = LocalSettings.Vars.GetValue.DefaultPageID} _ |
) |
routes.MapRoute( _ |
"Default", _ |
"{controller}/{action}/{id}", _ |
New With {.controller = "ID", .action = "Index", .pageID = LocalSettings.Vars.GetValue.DefaultPageID} _ |
) |
End Sub |
So what is funny here is two things....Once I fixed the above issue, I took a look at another page I have that load the ImageManager and DocumentManager directly, no RadEditor on the page, and they are working perfectly. They are also being called from a file in the root folder. So I added a test.aspx file in my root folder and added a radEditor and it works perfectly as well.....
The page that is not working is in a sub-directory, every-time I try to use a manager, I get that pop-up stating the Web.Config registration is missing, and then the 404. So I added another ignore to my routes:
routes.IgnoreRoute("<directoryname>/*") |
Is there something I am missing or does the <directoryname>/* not work?
I have tried using wildcard in the past in that way but hasnt worked for me. I think this line gives a good indication of how to use it
routes.IgnoreRoute("backoffice/{*pathInfo}") |
http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx
Hope that helps...
If I drag and drop the RadSpell control, it adds an extra form tag to the View page, which I then delete.
If I click on the RadSpell "SpellCheck" button, I get a dialog which says "Cannot find a TextSource. Please set the ControlToCheck server-side property or use the SetTextSource() client-side method." Setting the ControlToCheck to the RadEditor doesn't work, and I can't add Javascript to the client side in an MVC page containing only controls.
If I insert the RadSpell control AFTER the RadEditor control, I get a dialog saying "Web.config registration missing! The Telerik dialogs require a HttpHandler registration in the web.config file. Please use the control's Smart Tag to add the handler automatically...." The Server Error page says it can't find Telerik.Web.UI.DialogHandler.aspx. I set the handler in web.config to user DialogHandler.axd as per the instructions.
Alternatively, if I try the AJAX spell checker button in RadEditor, I get a "Spell Check Handler Server Error: 12030" dialog
Make sure that your web.config has the following two HTTP Handler definitions:
(for IIS 6)
<add verb="*" path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/> |
<add verb="*" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/> |
(for IIS 7)
<add name="Telerik.Web.UI.SpellCheckHandler.axd_*" path="Telerik.Web.UI.SpellCheckHandler.axd" verb="*" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode,runtimeVersionv2.0"/> |
<add name="Telerik.Web.UI.DialogHandler.axd_*" path="Telerik.Web.UI.DialogHandler.axd" verb="*" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode,runtimeVersionv2.0"/> |
Also, set the RadEditor property DialogHandlerUrl="Telerik.Web.UI.DialogHandler.axd". This should fix the issues you are having.
To enable spellchecking in RadEditor, you do not need to insert a separate RadSpell control on the page. RadSpell is included in the editor by default. Simply click the "AJAX Spellchecker" tool or press F7 while editing content to start the spell process.
If you get an error that RadSpell cannot find its dictionaries, then make sure you have added them to the ~/App_Data/RadSpell/ folder in your application (e.g. en-US.tdf for English language). If you receive a different exception, please copy the details or send us a screenshot so we can investigate further.
Regards,
Lini
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thanks for the reply. I still have not achieved success. Here's what my web.config looks like now:
<httpHandlers>
...
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
<add verb="*" path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>
<add verb="*" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>
</httpHandlers>
Here's my view page code:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Edit
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Edit</h2>
<% using (Html.BeginForm("Save", "Template")) { %>
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
</telerik:RadScriptManager>
<telerik:RadEditor ID="RadEditor1" runat="server" DialogHandlerUrl="Telerik.Web.UI.DialogHandler.axd" >
<CssFiles>
<telerik:EditorCssFile Value="~/Content/EditorContentArea.css" />
</CssFiles>
<Content>
</Content>
</telerik:RadEditor>
<input type="submit" value="Save" />
<% } %>
</asp:Content>
When I click on the AJAX Spell Checker button I get a "Spell Check Handler Server Error: 12031" dialog.
The dictionaries are in App_Data\RadSpell folder.
Frank
I have one more suggestion for you to try - set the SpellCheckSettings-AjaxUrl parameter of the RadEditor control as follows:
<telerik:RadEditor ID="RadEditor1" runat="server" DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd" SpellCheckSettings-AjaxUrl="/Telerik.Web.UI.SpellCheckHandler.axd">
Note the "/" at the start of the value - this tells the editor to look for the spell check handler at the root of the MVC web site. It should fix the 12030 error you received earlier.
Greetings,
Lini
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Frank
Telerik does not offer a spellchecker especially designed and build for ASP.NET MVC. The solution provided by Lini is for how to use RadSpell for ASP.NET AJAX in MVC projects. RadSpell for ASP.NET AJAX is part of the RadControls for ASP.NET AJAX suite which you can download from your account.
Best regards,
Rumen
the Telerik team