How to get drop down list value on popup form load

2 posts, 0 answers
  1. Victor
    Victor avatar
    23 posts
    Member since:
    Feb 2015

    Posted 20 May 2015 Link to this post

    When a row on a grid is clicked a popup form is opened. Inside the form I setup a Razor Kendo DropDownList from a database. I was able to mange the DropDownList to change HTML tables based on the drop down value. However, when the form is initially loaded I am not able to show the correct table in other words i am not able to get the value of the current displayed item. 

    This is how I change tables when the user select different item in the menu:

        $(function () {
                $('#PaymentType_ID').change(function () {
                    $('.payment').hide();
                    if ($(this).val() == "5") {
                        $('.payment').hide();                    
                    }

                    if ($(this).val() == "2") {
                        $('#creditCardPayment').show();
                        $('#generalPayment').show();
                    }

                    if ($(this).val() == "1" || $(this).val() == "3" || $(this).val() == "4") {
                        $('#otherPayment').show();
                        $('#generalPayment').show();
                    }
                });
            });

     

    I want to reuse most of the code but instead of using on .change I want to use something like .ready but it does not work.

    Anyone has any idea how should I try?

  2. Victor
    Victor avatar
    23 posts
    Member since:
    Feb 2015

    Posted 21 May 2015 Link to this post

    Figured it out. I put a wait call. The script was executing before the element was initiated.
  3. Kendo UI is VS 2017 Ready
Back to Top