ExpandMode="ServerSideCallBack" and "Script control is not a registered script control" error

2 posts, 0 answers
  1. Alexander
    Alexander avatar
    5 posts
    Member since:
    Mar 2012

    Posted 08 Apr 2012 Link to this post


    I'm experiencing a problem with RadTreeView when NodeTemplate has got a RadGrid inside of it. This generally works correct, but when ExpandMode="ServerSideCallBack" is used for node it gives an error message on expand, saying:

    Script control 'testGrid' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
    Parameter name: scriptControl

    This simple test page shows the problem for me:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestGridInTree.aspx.cs" Inherits="TestGridInTree" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
    <script type="text/javascript" language="javascript">
        AddServerNode = function (name, serverId) {
            treeView = $find("<%= TestTree.ClientID %>");
            var node = new Telerik.Web.UI.RadTreeNode();
        <form id="form1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <asp:Button runat="server" ID="btnAdd" Text="Add" OnClientClick="AddServerNode('client');return false;" />
            <Telerik:RadTreeView runat="server" ID="TestTree" OnNodeExpand="TestTree_NodeExpand">
                    <asp:Label runat="server" ID="lblTest" Text="test" />
                    <telerik:RadGrid runat="server" ID="testGird" />
                    <telerik:RadTreeNode runat="server" ID="node1" Text="ClientSide" ExpandMode="ServerSide"/>
                    <telerik:RadTreeNode runat="server" ID="node2" Text="ServerSideCallBack" ExpandMode="ServerSideCallBack" />

    using Telerik.Web.UI;
    public partial class TestGridInTree : System.Web.UI.Page
        protected void TestTree_NodeExpand(object sender, RadTreeNodeEventArgs e)
            var node = new RadTreeNode("childnode");

    In case there is a workaround for this - please note that I would like this to work for client-side added node also (Add button in sample above).
  2. Dimitar Terziev
    Dimitar Terziev avatar
    1266 posts

    Posted 11 Apr 2012 Link to this post

    Hello Alexander,

    The desired functionality is not supported from the Ajax Framework itself. When you make a callback to the server you could not load server controls as the RadGrid or any other control. This is caused by the fact that when you make callback a significant portion of the page life cycle is skipped and the RadGrid could not be initialized properly. Here is a thread discussing the difference between callback and regular post back. For your scenario you should use the ServerSide expand mode.

    Kind regards,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top