Hello,
I have a RadGrid with an Edit/Insert popup form based on a template. The RadGrid is AJAX enabled programmatically in the Page_Load() method.
In the template there is a RadListBox.
When I click on the Edit or Add buttons nothing happens but a Javascript exception is thrown:
Uncaught Sys.ArgumentUndefinedException: Sys.ArgumentUndefinedException: Value cannot be undefined. Parameter name: type I spent some time debugging the client code to find out what was causing such exception and it seemed that Javascript had no knowledge of the RadListBox (type undefined).
I found a temporary workaround by placing a dummy empty RadListBox in another place of the page.
This is not peculiar to RadListBox controls as it happens also with all other RadControls.
My conclusion is that if the edit form template contains RadControls which are nowhere else defined on the page, the associated client scripts and definitions are not properly loaded when using AJAX. Without enabling AJAX behavior everything works fine.
What am I doing wrong? Is there a solution?
Thanks in advance,
Mauro
Telerik version: 2013.1.220.35
Language: C#
Platform: Sharepoint Server 2010
I have a RadGrid with an Edit/Insert popup form based on a template. The RadGrid is AJAX enabled programmatically in the Page_Load() method.
RadAjaxManager ram = RadAjaxManager.GetCurrent(Page);
ram.AjaxSettings.AddAjaxSetting(RadGrid1, RadGrid1, RadAjaxLoadingPanel1);
<
telerik:RadScriptManager
id
=
"ScriptManager"
runat
=
"server"
EnableScriptCombine
=
"true"
EnablePageMethods
=
"false"
EnablePartialRendering
=
"true"
EnableScriptGlobalization
=
"false"
EnableScriptLocalization
=
"true"
>
<
Scripts
>
<
asp:scriptreference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
></
asp:scriptreference
>
<
asp:scriptreference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
></
asp:scriptreference
>
<
asp:scriptreference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
></
asp:scriptreference
>
</
Scripts
>
</
telerik:RadScriptManager
>
protected
override
void
OnInit(EventArgs e)
{
base
.OnInit(e);
// Add an RadAjaxManager to the page.
SetUpAjaxManagerOnPage();
// Create child controls (if necessary).
EnsureChildControls();
}
protected
void
SetUpAjaxManagerOnPage()
{
// Check if there is already an Ajax Manager somewhere on the page.
RadAjaxManager currentAjaxManager = RadAjaxManager.GetCurrent(Page);
if
(currentAjaxManager ==
null
)
{
Page.Form.Controls.AddAt(0, AjaxManager);
Page.Items.Add(
typeof
(RadAjaxManager), AjaxManager);
}
}
protected
virtual
RadAjaxManager AjaxManager
{
get
{
if
(_ajaxManager ==
null
)
{
_ajaxManager = RadAjaxManager.GetCurrent(Page);
if
(_ajaxManager ==
null
)
{
_ajaxManager =
new
RadAjaxManager() { ID =
"RadAjaxManager1"
};
}
}
return
_ajaxManager;
}
}
In the template there is a RadListBox.
<
telerik:RadListBox
runat
=
"server"
ID
=
"RadListBoxCharacteristicValues"
DataValueField
=
"CharacteristicValuedID"
DataTextField
=
"CharacteristicVal"
AllowReorder
=
"true"
AllowDelete
=
"true"
EnableDragAndDrop
=
"true"
Height
=
"150px"
Width
=
"240px"
/>
When I click on the Edit or Add buttons nothing happens but a Javascript exception is thrown:
Uncaught Sys.ArgumentUndefinedException: Sys.ArgumentUndefinedException: Value cannot be undefined. Parameter name: type I spent some time debugging the client code to find out what was causing such exception and it seemed that Javascript had no knowledge of the RadListBox (type undefined).
I found a temporary workaround by placing a dummy empty RadListBox in another place of the page.
This is not peculiar to RadListBox controls as it happens also with all other RadControls.
My conclusion is that if the edit form template contains RadControls which are nowhere else defined on the page, the associated client scripts and definitions are not properly loaded when using AJAX. Without enabling AJAX behavior everything works fine.
What am I doing wrong? Is there a solution?
Thanks in advance,
Mauro
Telerik version: 2013.1.220.35
Language: C#
Platform: Sharepoint Server 2010