New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Telerik Web UI Editor CommandList CommandName is null

Problem

Error: Telerik.Web.UI.Editor.CommandList["CommandName"] is null

DESCRIPTION

If RadEditor is initially hidden and then displyed using AJAX the client Telerik.Web.UI.Editor.CommandList object will be not recognized and the following error will be thrown "Telerik Web UI Editor CommandList is null".

The browser reports an error at the Telerik.Web.UI.Editor.CommandList["Save"] line:

ASP.NET
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
<script type="text/javascript">  
    Telerik.Web.UI.Editor.CommandList["Save"] = function(commandName, editor, args)  
    {  
        $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("save");  
    }  
</script>  
</telerik:RadCodeBlock> 

SOLUTION

The problem occurs when the RadEditor container to the page is loaded using AJAX. This is a well known limitation of the MS AJAX that will not parse <script> tags declared in the panel loaded. The following blog post discusses it.

One alternative approach to fix the problem is to declare on your page (out of any AJAX panel):

Javascript
function OnClientCommandExecuting(editor, args)  
{  
   if (args.get_commandName() == "Save")  
  {  
      $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("save");     
      args.set_cancel(true);  
  }  
} 

Then, just set the OnClientCommandExecuting property of RadEditor, e.g.

ASP.NET
<telerik:RadEditor OnClientCommandExecuting="OnClientCommandExecuting" .../>
In this article
ProblemDESCRIPTIONSOLUTION
Not finding the help you need?
Contact Support