Uncaught ReferenceError: nameOfControl is not defined

2 posts, 0 answers
  1. Tomasz
    Tomasz avatar
    1 posts
    Member since:
    Mar 2019

    Posted 22 Mar Link to this post

    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 telerik:RadScriptManager 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.

     

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    588 posts

    Posted 26 Mar Link to this post

    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.
Back to Top