Home / Community & Support / Knowledge Base / RadControls for ASP.NET and ASP.NET AJAX / Editor / Error: Telerik.Web.UI.Editor.CommandList["CommandName"] is null

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

Article Info

Rating: 5

Article information

Article relates to

 RadEditor for ASP.NET AJAX
Telerik.Web.UI

Created by

 Rumen Zhekov


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:
<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 this:
http://blogs.telerik.com/tervelpeykov/posts/08-10-20/AJAX_Using_AJAX_to_load_a_usercontrol_that_has_JavaScript_declared_in_it.aspx 

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

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.

<telerik:RadEditor OnClientCommandExecuting="OnClientCommandExecuting" .../>

Comments

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.