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

RadEditor Save and Cancel buttons

4 Answers 196 Views
Editor
This is a migrated thread and some comments may be shown as answers.
DW Web Team Member
Top achievements
Rank 2
DW Web Team Member asked on 14 Sep 2010, 07:43 PM

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

4 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 15 Sep 2010, 03:31 PM
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
0
DW Web Team Member
Top achievements
Rank 2
answered on 15 Sep 2010, 05:14 PM
Of course! Thank you very much!!!
0
Jon Shipman
Top achievements
Rank 1
answered on 07 Jan 2011, 05:13 PM
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!
0
Dobromir
Telerik team
answered on 10 Jan 2011, 11:45 AM
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.
Tags
Editor
Asked by
DW Web Team Member
Top achievements
Rank 2
Answers by
Rumen
Telerik team
DW Web Team Member
Top achievements
Rank 2
Jon Shipman
Top achievements
Rank 1
Dobromir
Telerik team
Share this question
or