This is a migrated thread and some comments may be shown as answers.

Using Rad Editor into MVC page !

15 Answers 533 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Labmaieutiche
Top achievements
Rank 2
Labmaieutiche asked on 27 Nov 2008, 01:08 PM
Good morning !

There is any project sample for using RadEditor into an MVC .NEt project ?

15 Answers, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 01 Dec 2008, 12:09 PM
Hello Labmaieutiche,

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.
0
Gpl
Top achievements
Rank 1
answered on 02 Jan 2009, 12:07 PM
Hi There,

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
0
Tervel
Telerik team
answered on 06 Jan 2009, 02:04 PM
Hi 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.
0
Clint MacDonald
Top achievements
Rank 2
answered on 13 Feb 2009, 01:51 PM
Thank-you for the example but I am having problems getting the Dialogue boxes coming up on a non-MVC page in an MVC application.

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" /> 
 
and the handlers in the system.webServer:
      <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" /> 
        <%}%> 
part, and even when I tried it, the "BeginForm" threw an exception.

Any ideas?
0
Gpl
Top achievements
Rank 1
answered on 13 Feb 2009, 01:57 PM
Hi There,

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

0
Clint MacDonald
Top achievements
Rank 2
answered on 13 Feb 2009, 02:45 PM
Thanks for the reply GPL, I am sure that was going to be another issue.....as well.

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>/*") 
but this did not seem to do anything.

Is there something I am missing or does the <directoryname>/* not work?
0
Gpl
Top achievements
Rank 1
answered on 13 Feb 2009, 02:54 PM
Have you looked at the logs to see what path is being used to load the handlers i.e. whethr the sub directory is being used or not?
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}") 
Have you used the route debug tool, its very handy will show you if route search was done and if so what was found to be matching
http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx

Hope that helps...




0
Frank
Top achievements
Rank 1
answered on 27 Apr 2009, 06:03 PM
Can I use RadSpell on the RadEditor content in an MVC page?
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.

0
Frank
Top achievements
Rank 1
answered on 27 Apr 2009, 06:40 PM
Additional results of my attempt to use RadSpell on RadEditor in an MVC view page:
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
0
Lini
Telerik team
answered on 28 Apr 2009, 06:16 AM
Hi Frank,

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.
0
Frank
Top achievements
Rank 1
answered on 28 Apr 2009, 03:25 PM

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0
Lini
Telerik team
answered on 29 Apr 2009, 12:31 PM
Hi 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.
0
Frank
Top achievements
Rank 1
answered on 29 Apr 2009, 03:18 PM
That did the trick! Now it's working. Thanks for your persistance. I really appreciate Telerik's efforts not only in making your controls work in the intrinsically non-postback MVC environment but also your assistance in showing us how.

Frank
0
rajesh
Top achievements
Rank 1
answered on 03 Dec 2010, 10:39 PM
Please can you post the link for MVC spell chek telerik rad control download
0
Rumen
Telerik team
answered on 06 Dec 2010, 10:22 AM
Hi Rajesh,

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
Browse the vast support resources we have to jumpstart 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.
Tags
Editor
Asked by
Labmaieutiche
Top achievements
Rank 2
Answers by
Tervel
Telerik team
Gpl
Top achievements
Rank 1
Clint MacDonald
Top achievements
Rank 2
Frank
Top achievements
Rank 1
Lini
Telerik team
rajesh
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or