Cannot call method 'value' of kendoDropDownList before it is initialised error

7 posts, 0 answers
  1. Martin
    Martin avatar
    7 posts
    Member since:
    Nov 2006

    Posted 31 Jul 2013 Link to this post

    Hi,

    I am using the cascading combo box in a very similar way to the MVC demo on the demos page. I currently have 6 combo boxes cascaded together in the same page. Occasionally I am getting the exception below, I assume this is because the page isn't fully loaded and the user has tried to interact with the page, therefore causing the combo to attempt to submit an AJAX request to get it's data.

        Microsoft JScript runtime error: Cannot call method 'value' of kendoDropDownList before it is initialized

    Is there a correct way of checking whether Kendo controls are fully initialised ? If not how can I catch this exception ?
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 02 Aug 2013 Link to this post

    Hello Martin,

    We are not really sure what's the logic behind that error.

    Basically when using the Html Helper extensions of MVC and you want to make sure that the widget is initialized you need to execute your code inside a document ready handler attached after the code for the widget.

    For example:

    @(Html.Kendo().SomeWidget().Name("Foo")...)
     
    <script>
          $(function(){
                 alert('Foo should be initialized and accessible at this point!');
          })
    </script>

    I hope this helps.

    Kind Regards,
    Petur Subev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Gabriel
    Gabriel avatar
    2 posts
    Member since:
    Jun 2013

    Posted 18 May 2014 in reply to Petur Subev Link to this post

    This seems to be a bug within Kendo not developer code, I attempted to wrap all client side interactions with the kendo control with document ready and still have this exact error occurring. Confirmed this happens in all three browsers.
  5. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 21 May 2014 Link to this post

    Hello Martin,

    Could you please demonstrate your case with a small demo, so we can see exactly what is going wrong. You are the first one to experience such issue. Make sure you check the troubleshooting cases before that:

    http://docs.telerik.com/kendo-ui/getting-started/troubleshooting

    Regards,
    Petur Subev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Vidya
    Vidya avatar
    1 posts
    Member since:
    Mar 2014

    Posted 26 Sep 2014 in reply to Petur Subev Link to this post

    Did anybody ever found any solution for that "Cannot call method 'value' of kendoDropDownList before it is initialized" exception, because I am getting the exact same error when trying to load a KendoGrid in a Div?
  7. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 01 Oct 2014 Link to this post

    Hello Vidya,

    This is a common exception which might be caused by several reasons all covered in our troubleshooting section:

    http://docs.telerik.com/kendo-ui/troubleshooting

    Kind Regards,
    Petur Subev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  8. Manish
    Manish avatar
    3 posts
    Member since:
    Aug 2014

    Posted 09 Nov 2015 in reply to Vidya Link to this post

    Hi Vidya,

    I faced the same issue, and yes there is a fix for it, basically you just need to destroy the grid before your redirect...

    The best way to tackle this is by using "resolve" in $routeProvider

    $routeProvider.when('/' + nPageData.id, {
                            controller: nPageData.id + "Controller",
                            template: vm.getPageHTML(nPageData),
                            resolve:{
                                "kendogridfix":function($location){
                                    angular.element("[kendo-grid]").each(function(idx,kGrid){
                                        var dataObj=angular.element(kGrid).data();
                                        for(mData in dataObj)
                                        {
                                            if(angular.isObject(dataObj[mData]))
                                            {
                                                if("destroy" in dataObj[mData])
                                                {
                                                    dataObj[mData].destroy();
                                                }
                                            }
                                        }
                                    })
                                }
                            }
                        });

     

    Hope this helps...

Back to Top
Kendo UI is VS 2017 Ready