Using Rad Editor into MVC page !

16 posts, 0 answers
  1. Labmaieutiche
    Labmaieutiche avatar
    4 posts
    Member since:
    Jul 2008

    Posted 27 Nov 2008 Link to this post

    Good morning !

    There is any project sample for using RadEditor into an MVC .NEt project ?
  2. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 01 Dec 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gpl
    Gpl avatar
    3 posts
    Member since:
    Dec 2008

    Posted 02 Jan 2009 Link to this post

    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
  5. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 06 Jan 2009 Link to this post

    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.
  6. Clint MacDonald
    Clint MacDonald avatar
    32 posts
    Member since:
    May 2005

    Posted 13 Feb 2009 Link to this post

    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?
  7. Gpl
    Gpl avatar
    3 posts
    Member since:
    Dec 2008

    Posted 13 Feb 2009 Link to this post

    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

  8. Clint MacDonald
    Clint MacDonald avatar
    32 posts
    Member since:
    May 2005

    Posted 13 Feb 2009 Link to this post

    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?
  9. Gpl
    Gpl avatar
    3 posts
    Member since:
    Dec 2008

    Posted 13 Feb 2009 Link to this post

    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...




  10. Frank
    Frank avatar
    15 posts
    Member since:
    Apr 2009

    Posted 27 Apr 2009 Link to this post

    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.

  11. Frank
    Frank avatar
    15 posts
    Member since:
    Apr 2009

    Posted 27 Apr 2009 Link to this post

    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
  12. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 28 Apr 2009 Link to this post

    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.
  13. Frank
    Frank avatar
    15 posts
    Member since:
    Apr 2009

    Posted 28 Apr 2009 Link to this post

    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

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  14. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 29 Apr 2009 Link to this post

    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.
  15. Frank
    Frank avatar
    15 posts
    Member since:
    Apr 2009

    Posted 29 Apr 2009 Link to this post

    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
  16. rajesh
    rajesh avatar
    2 posts
    Member since:
    Dec 2010

    Posted 03 Dec 2010 Link to this post

    Please can you post the link for MVC spell chek telerik rad control download
  17. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 06 Dec 2010 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017