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

Uncaught ReferenceError: nameOfControl is not defined

1 Answer 117 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Tomasz
Top achievements
Rank 1
Tomasz asked on 22 Mar 2019, 10:33 AM

Hi guys,

I tried to fix a defect in application. Durning investigation I found out that in js fails on that line

$create(Telerik.Web.UI.RadComboBox, {"_dropDownWidth":0,"_isTemplated":true,"_maxHeight":100,"_skin":"Default","_text":"LE Value1,LE Value2,LE Value3","_uniqueId":"ctl00$DefaultContent$CaseDetailsControl_3$mscCaseType$ddlComboBox","allowCustomText":true,"clientStateFieldID":"ctl00_DefaultContent_CaseDetailsControl_3_mscCaseType_ddlComboBox_ClientState","collapseAnimation":"{\"duration\":450}","expandAnimation":"{\"duration\":450}","filter":2,"highlightTemplatedItems":true,"itemData":[{"text":"LE Value1","value":"103"},{"text":"LE Value2","value":"20002"},{"text":"LE Value3","value":"320"}]}, {"dropDownClosed":LaunchPostback_ctl00_DefaultContent_CaseDetailsControl_4_mscCaseType}, null, $get("ctl00_DefaultContent_CaseDetailsControl_3_mscCaseType_ddlComboBox"));

 

In js consol I can see an error.

Uncaught ReferenceError: LaunchPostback_ctl00_DefaultContent_CaseDetailsControl_4_mscCaseType is not defined
    at Array.<anonymous> (CaseDashboard.aspx?C...tionStack=true:1152)
    at Telerik.Web.UI.WebRe...cacbc31:6
    at Sys._Application._raiseInit (Telerik.Web.UI.WebRes...4cacbc31:6)
    at Sys._Application.initialize (Telerik.Web.UI.WebRe...cacbc31:6)
    at b (Telerik.Web.UI.WebRe...cacbc31:6)
    at HTMLDocument.a (Telerik.Web.UI.WebRes...cacbc31:6)

 

I played around to find the solution. The thing which I found out and works is that:

 

$create(Telerik.Web.UI.RadComboBox, {"_dropDownWidth":0,"_isTemplated":true,"_maxHeight":100,"_skin":"Default","_text":"LE Value1,LE Value2,LE Value3","_uniqueId":"ctl00$DefaultContent$CaseDetailsControl_3$mscCaseType$ddlComboBox","allowCustomText":true,"clientStateFieldID":"ctl00_DefaultContent_CaseDetailsControl_3_mscCaseType_ddlComboBox_ClientState","collapseAnimation":"{\"duration\":450}","expandAnimation":"{\"duration\":450}","filter":2,"highlightTemplatedItems":true,"itemData":[{"text":"LE Value1","value":"103"},{"text":"LE Value2","value":"20002"},{"text":"LE Value3","value":"320"}]}, {"dropDownClosed":"LaunchPostback_ctl00_DefaultContent_CaseDetailsControl_4_mscCaseType"}, null, $get("ctl00_DefaultContent_CaseDetailsControl_3_mscCaseType_ddlComboBox"));

 

I added quote to name of control which is probelby not defined and app works!

I found that solution: https://www.telerik.com/forums/telerik-web-ui-radcombobox-undefined-in-the-version-2015-2-623-45 

I don't want to use that solution, because we use  only once in the application and it is so generic, that app pages use this RadScriptManager. I have no idea what influence will have that change on the whole app.

 

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 26 Mar 2019, 03:16 PM
Hello Tomasz,

The dropDownClosed property which you see in the $create statement is for the handler function for the OnClientDropDownClosed client-side event: https://docs.telerik.com/devtools/aspnet-ajax/controls/combobox/client-side-programming/events/onclientdropdownclosed.

Please ensure that you are passing a function name to the OnClientDropDownClosed property of the RadComboBox as explained in https://docs.telerik.com/devtools/aspnet-ajax/getting-started/customize-control-behavior#client-side-event-handling.

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ComboBox
Asked by
Tomasz
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or