RadEditor Save and Cancel buttons

5 posts, 1 answers
  1. DW Web Team Member
    DW Web Team Member avatar
    43 posts
    Member since:
    Jun 2012

    Posted 14 Sep 2010 Link to this post

    Hi,
    I try to add the Save and Cancel buttons to a RadEditor’s Toolbar by using the approach on the http://www.telerik.com/help/aspnet-ajax/addingsaveandcancelbuttonstoolbar.html page. When I run the code, I have the javascript error: “Microsoft JScript runtime error: 'RadEditorCommandList' is undefined”. Could you please let me know what I am missing?
    Thank you

  2. Answer
    Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 15 Sep 2010 Link to this post

    Hi,

    You should wrap the Telerik.Web.UI.Editor.CommandList function in if (typeof (RadEditorCommandList) != "undefined"){ } check so that when the editor is not rendered on the page the undefined error to not pop up, e.g.

    <telerik:radeditor runat="server" ID="RadEditor1" Enabled="false"> 
        <Tools> 
            <telerik:EditorToolGroup> 
                <telerik:EditorTool Name="Save" /> 
            </telerik:EditorToolGroup> 
        </Tools> 
        <content> 
        </content> 
    </telerik:radeditor> 
    <script type="text/javascript"> 
        if (typeof (RadEditorCommandList) != "undefined")  
        { 
            Telerik.Web.UI.Editor.CommandList["Save"] = function(commandName, editor, args)  
            { 
                var btnSubmit = $get("<%=btnSubmit.ClientID%>"); //get a reference to the Asp:Button 
                btnSubmit.click(); //click it programmatically 
            }; 
        } 
    </script>  
    <asp:Button style="display:none;" ID="btnSubmit" runat="server" Text="Submit" /> 

    If you scenario is other, please open a support ticket and send a sample working project that demonstrates the error.

    Sincerely yours,
    Rumen
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. DW Web Team Member
    DW Web Team Member avatar
    43 posts
    Member since:
    Jun 2012

    Posted 15 Sep 2010 Link to this post

    Of course! Thank you very much!!!
  5. Jon Shipman
    Jon Shipman avatar
    43 posts
    Member since:
    Nov 2009

    Posted 07 Jan 2011 Link to this post

    My editor starts with Enabled="false" so I have this issue as well.  I'm using an ajaxified linkbutton click to enable the ajaxified editor.

    So wrapping the script prevents it from running when the editor is not enabled, but enabling it through ajax doesn't run the script.

    I'm having trouble figuring out how and when to get the script to run.  Can you help?  Thanks!
  6. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 10 Jan 2011 Link to this post

    Hi Jon,

    I already answered your support ticket on the subject. For convenience I will paste my answer here as well:

    This alert occurs because RadEditor's custom commands are registered as a inline JavaScript and such scripts are not executed again after AJAX update.

    You can find more detailed information and solutions to for this scenario in the following blog post:
    http://blogs.telerik.com/tervelpeykov/posts/08-10-20/ajax_using_ajax_to_load_a_usercontrol_that_has_javascript_declared_in_it.aspx


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