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

[Solved] radscriptmanager error

6 Answers 265 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Sander
Top achievements
Rank 1
Sander asked on 12 Mar 2008, 11:39 AM
Hi,

I get the next javascript error using the radtree:

"sys.argumentexception: value must not be null for Controls and Behaviors"

I'm using the tree on a control; and this control is placed dynamically on a multipage.

The scripmanager is placed in the form on the mainpage.

How can I access the scriptmanager from my control?

Thanks in advance,

Sander van Leeuwen

6 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 13 Mar 2008, 08:55 AM
Hi Sander,

As a page can contain only one ScriptManager control, you can get a reference to it using ScriptManager.GetCurrent(Page). You can then cast it to RadScriptManager when needed, e.g.:
C#:
RadScriptManager pageScriptManager = (RadScriptManager)ScriptManager.GetCurrent(Page);
VB:
Dim pageScriptManager as RadScriptManager = CType(ScriptManager.GetCurrent(Page), RadScriptManager);

Regarding the error you get - it is typically caused by the control initializer not finding the control element. For example, if your code outputs the script to create a control after an Ajax call, but it does not update the control HTML, the $create function throws this error.

I hope this helps.

Best regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sander
Top achievements
Rank 1
answered on 13 Mar 2008, 10:07 AM
Hi Erjan,

the problem is I can't make a reference, because it's the treeview has no property to make a reference to the scriptmanager

Kind regards,

Sander van Leeuwen
0
Erjan Gavalji
Telerik team
answered on 13 Mar 2008, 10:19 AM
Hi Sander,

I believe I am missing something. Can you please send us either the control you create, or its simplified version that could demonstrate the problem to us? Can you also specify what kind of a ScriptManager reference would you need and why? We will do our best to help.

Best regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sander
Top achievements
Rank 1
answered on 13 Mar 2008, 10:35 AM
Hi Erjan

I've got a page, page.aspx, which has the radscriptmanager included.
On this page is a radmultipage with some pageviews.
On one of the pageviews I'm using a usercontrol, wucICFVragen.
This usercontrol contains the treeview, and this treeview needs a reference to the scriptmanager.

Hoping you can solve my problem,

Thanks in advance,

Sander van Leeuwen

Here is the code:

-- code snippet page.aspx --
<body>
    <form id="frmScherm0304" runat="server" enableviewstate="true">  
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            </telerik:RadScriptManager>
            <radTS:RadMultiPage ID="radmp" runat="server">
                <radTS:PageView ID="radpv0" runat="server" Width="100%">
                        <asp:UpdatePanel ID="updpnlRight" runat="server">
                            <ContentTemplate>
                            <icf:wucICFVragen ID="wucICFVragenRechts" runat="server" />
                            </ContentTemplate>
                </radTS:PageView>
                <radTS:PageView ID="radpv1" runat="server">
                    <iframe id="radpv1_frame" src="" originalAttribute="src" originalPath="" runat="server" frameborder="0" style="position:absolute;top:40px;height:99.9%"></iframe>
                </radTS:PageView>
            </radTS:RadMultiPage>
    </form>
</body>
-- code snippet usercontrol icf:wucICFVragen --
<asp:Panel ID="wucICFVragen_DragDrop_pnl" CssClass="wucICFVragen_DragDrop_pnl" runat="server">
    <asp:Panel ID="wucICFVragen_DragDrop_pnl_pnlleft" CssClass="wucICFVragen_DragDrop_pnl_pnlleft"
        runat="server" >
        <telerik:RadTreeView ID="wucICFVragen_DragDrop_pnl_treeLeft" style="display:none" runat="server" EnableAjaxSkinRendering="false" Enabled="False" WebServiceSettings-Method="" >
        </telerik:RadTreeView>
    </asp:Panel>
</asp:Panel>
0
Erjan Gavalji
Telerik team
answered on 13 Mar 2008, 12:26 PM
Hi Sander,

RadTreeView "Prometheus" (actually each control in the "Prometheus" suite) finds the ScriptManager instance using code similar to what I sent you (
ScriptManager.GetCurrent(Page);
). Having that in mind, if your page contains a RadScriptManager, RadTreeView finds the instance. In addition - if the control cannot find the ScriptManager instance, it throws a server-side exception with a message, notifying that it could not find a ScriptManager on the page.

I just played with the code you sent me - I created a small website and added a page and a user control to it. I loaded the page successfully - I did not get the error. Please, find attached the files I used (you should add the RadControls folder and the bin folder with the assemblies in order to run it).

Let me know what I am missing.

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sander
Top achievements
Rank 1
answered on 13 Mar 2008, 02:31 PM
Hi Erjan

I've found the solution: it was a timing-problem: I sent an AJAX-request to the server, when it was still getting the data from the server :-(

Thanks for your time

Sander van Leeuwen
Tags
TreeView
Asked by
Sander
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Sander
Top achievements
Rank 1
Share this question
or