RadEditor in SharePoint 2010

11 posts, 1 answers
  1. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 19 Jan 2010 Link to this post

    I have created a visual webpart for SharePoint 2010 that uses the RadEditor (v 2009.2.826.20).  I am able to edit content and apply styling in the editor.  However, the "Content" property of the editor control never updates. 

    Two "errors" I have encountered.
    1) The editor area is grey instead of white.

    2) When accessing a Paste function, e.g. Paste Plain Text, I get an error saying web.config registration is missing and references a HTTPHandler registration for Telerik. I have added this httphandler registration and still get the error.  However, I noticed it is trying to access a resource at the wrong location.  Instead of accessing at the root, it is attempting to access it from the location of visual webpart.  See below

    /_CONTROLTEMPLATES/ContentEditor/ContentEditor/Telerik.Web.UI.DialogHandler.aspx?DialogName=CleanPasteHtmlContent&Skin=Office2007&Title=Paste%20As%20Html&doid=0909488d-b2fa-4b55-8b15-a56c0f218612&dpptn=&dp=Z2JxKWguPVURbnVaYmNhWGJlF3RrawpdbXIQdFZyY0pVfmIoVQBIdmxvTEttF044eXMWOFUUEA4RbnFbYVlLX2pldF5oZBZaYhYQFVUHWUVXQEwDaBRIS29rQ0t7Ams7UWIRdmcEE0oZYQ5DWU0GdlllA0RQASB0YhYYMVZYWQBVbg0xfShiQWxvTEdtdWt3VnISDmgUdFUPfB5bWnx9X3R2BERkWCBmW3AyGGdbd1hRbWIdZi9Ue1FubmdWd28RYwQONmsGJgwmbDxBbVpxaW4BLQVlWQZ%2BXCwINGFbWVl5V1xyZQRDSVFVYkVVDHcrZwUeE2YVLXYOfzRlWXBxWm4BLXFrZSB2W3MLOG0Ge3pmVX43aChUZlBvcmlUd28VeFkeMWUEPW4QUjx3aVhXUm93NQFrZScEXBcAFGdtUX5mfkB1ZRRbAXt9BUBgHG8MVF4CO2IWE3YObg56bV51WVpkEAJrXnVmdRYQCGdYXVllClAqZxZYZlRvfnlVA0kWeFkdcGcoJgwgVTRrdnBffW53KQNlXnV2WgR3d24GXX9VVW40ZhViflQIAXNnEAl1YXJ9K2gUPUkmVAIDWWMKRm11AwdTcDx2YRY6O25mQkd4fUACVAtiXVZVAVlVAWsybGI8N2twC2gaYRZcdHFpW1p6C1t%2BdwVCd3E6KVZYUQFtblAofQZqWVdwel17AHgxYlkncVUFH24XbXQO

    Any input would greatly be appreciated!
    --Jason



  2. Answer
    Lini
    Admin
    Lini avatar
    2144 posts

    Posted 20 Jan 2010 Link to this post

    Hello Jason,

    Are you submitting the page using Ajax? When are you trying to access the editor content in the server code? If you are submitting the page with custom client code, try calling the client API function saveContent() - e.g.:

    var editor = $find("RadEditor_client_id");
    editor.saveContent();

    If you are trying to access the content on the server in an early stage (e.g. OnInit event) it might still be unavailable because the LoadPostData method of the page has not been called yet.

    The editor content area picks up the background color from its parent page. In your case the page background is gray, so you see the same in the editor. To fix this, you need to override the default behavior by using the editor's CssFiles collection (load alternate styles instead of the ones from the parent page) or override the page background by specifying an alternate content area CSS file (this will keep the rest of the styles in the content area intact). The second approach can be seen on our online demos - http://demos.telerik.com/aspnet-ajax/editor/examples/settingcontentareadefaults/defaultcs.aspx

    Finally, to change the place where the editor looks for its dialog handler, you can try setting the DialogHandlerUrl property to "~/Telerik.Web.UI.DialogHandler.axd" and modifying your web.config registration to use the name Telerik.Web.UI.DialogHandler.axd instead of Telerik.Web.UI.DialogHandler.aspx (note the extensions - axd vs aspx). This is the last suggestion we give in the KB article about the error you saw - http://www.telerik.com/support/kb/aspnet-ajax/editor/error-web-config-registration-missing-the-telerik-dialogs-require-a-httphandler-registration-in-the-web-config-file.aspx

    Best wishes,
    Lini
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 20 Jan 2010 Link to this post

    Thank you.  Your answer guided me in the correct direction.  Now, I am encountering a problem with (dis)enabling the Editor.  I have a "Edit" button the enables the editor (RadEditor.enabled = true).  It works as expected.  In "edit" mode, I have a "Save" button to save the changes and disable the editor (RadEditor.enabled = false).  It works as expected.  If I click the Edit button again, the Editor control does not draw correctly: no toolbars, unable to click in editor to type text, only white box overlapping grey box. 

    I am using the RadAjaxManager to control my controls.  If I remove the RadAjaxManager, everything works as expected, i.e. clicking Edit a second time works.

    here is my setting for the RadAjaxManager:
    <telerik:RadAjaxManager id="contenteditorRadAjaxManager" runat="server">
            <ajaxsettings>
                <telerik:AjaxSetting AjaxControlID="radContentEditor">
                    <updatedcontrols>
                        <telerik:AjaxUpdatedControl ControlID="btnEdit" />
                        <telerik:AjaxUpdatedControl ControlID="btnSave" />
                        <telerik:AjaxUpdatedControl ControlID="btnCancel" />
                    </updatedcontrols>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnEdit">
                    <updatedcontrols>
                        <telerik:AjaxUpdatedControl ControlID="radContentEditor" />
                        <telerik:AjaxUpdatedControl ControlID="btnSave" />
                        <telerik:AjaxUpdatedControl ControlID="btnCancel" />
                    </updatedcontrols>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnSave">
                    <updatedcontrols>
                        <telerik:AjaxUpdatedControl ControlID="radContentEditor" />
                        <telerik:AjaxUpdatedControl ControlID="btnEdit" />
                        <telerik:AjaxUpdatedControl ControlID="btnCancel" />
                    </updatedcontrols>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="btnCancel">
                    <updatedcontrols>
                        <telerik:AjaxUpdatedControl ControlID="radContentEditor" />
                        <telerik:AjaxUpdatedControl ControlID="btnEdit" />
                        <telerik:AjaxUpdatedControl ControlID="btnSave" />
                    </updatedcontrols>
                </telerik:AjaxSetting>
            </ajaxsettings>
        </telerik:RadAjaxManager>


  5. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 22 Jan 2010 Link to this post

    Hi,

    This sounds like the editor skin is not being applied once the editor is disabled and then enabled again using Ajax. I suggest that you try setting the EnableAjaxSkinRendering property of the editor to true when you enable/disable it. For example:

    protected void ButtonEdit_Click(object sender, EventArgs e)
    {
        RadEditor1.Enabled = true;
        RadEditor1.EnableAjaxSkinRendering = true;
    }

    Sincerely yours,
    Lini
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 22 Jan 2010 Link to this post

    that didn't fix it.
  7. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 25 Jan 2010 Link to this post

    Hello,

    If the problem is not in the editor skins, then it is probably due to a JavaScript error, preventing the editor from initializing correctly the second time. To verify this, see if the problem happens in different browsers (e.g. Internet Explorer, Firefox) and copy any JS exception details you see in the browser. If possible, attach a screenshot or open a formal support ticket and send us a sample page which shows the problem - I don't think that this is related to SharePoint 2010 specifically.


    All the best,
    Lini
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 25 Jan 2010 Link to this post

    Thank you.  I found a work around.  If I place the AJAX Manager on the master page and a Proxy on the user control, the "redraw" happens correctly.  However, the only problem I have encountered with this "fix", is that the usercontrol buttons and controls aren't initially ajaxified.  The usercontrol calls an actual postback initially, but after that the controls are handled by ajax correctly.  I have seen this bug mentioned recently throughout the forums with various workarounds.  But it is not a breaking bug for me at this time.


  9. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 26 Jan 2010 Link to this post

    Hi Jason,

    Can you please try adding the usercontrol's ajax setting in its PreRender event instead declaratively through RadAjaxManagerProxy and see if this make any difference in the observed behavior.

    Sincerely yours,
    Rosen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  10. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 26 Jan 2010 Link to this post

    Yea, I have tried that already.  Also tried adding the Proxy via code along with it's settings. 
  11. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 27 Jan 2010 Link to this post

    Hello,

    The approach, which Rosen described, worked fine in MOSS 2007. We will need to do some more testing with the SP 2010 beta, but initially it seemed to work fine there as well.

    Kind regards,
    Lini
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  12. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 27 Jan 2010 Link to this post

    To followup with more information....

    If I set the ajax settings on the prerender event, the initial postback is ajax.  However, my initial "redraw" problem occurs again. The second attempt of enabling the editor, the toolbars and such do not draw correctly.  But if the editor is set as enabled on the initial load of the page, everything works correctly - ajax and redraw.  Apparently, the problem exists when the editor is initially disabled, which I need.

    My current workaround is setting the ajax settings in design mode.  The initial postback is not ajaxed, but the control is still usable on subsequent edits (disabling/enabling) and becomes ajaxified.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017