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

How to get drop down list value on popup form load

1 Answer 24 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 20 May 2015, 04:49 PM

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?

1 Answer, 1 is accepted

Sort by
0
Victor
Top achievements
Rank 1
answered on 21 May 2015, 01:51 PM
Figured it out. I put a wait call. The script was executing before the element was initiated.
Tags
DropDownList
Asked by
Victor
Top achievements
Rank 1
Answers by
Victor
Top achievements
Rank 1
Share this question
or