HOW TO FORCE USER TO SELECT DROP DOWN LIST ITEM FIRST BEFORE CONTINUE NEXT IN C#

Chintoo Semi

Total Post:135

Points:947
Posted by  Chintoo Semi
C# 
 854  View(s)
Ratings:
Rate this:
for example of this website, the quick ticket session. i need to force users to select a movie first before select the Cinema
  1. john rob

    Post:108

    Points:756
    Re: how to force user to select drop down list item first before continue next in C#

    You can use some jQuery magic to do this:

    $(function() {

        $('#ddlSelectCinema').prop('disabled', true);

        $('#ddlSelectSession').prop('disabled', true);

    });

    This code will disable the "Select Cinema" and "Select Session" drop downs. Then you need an event handler on the drop downs:

    $(function() {

        $('#ddlSelectMovie').change(function() {

            $('#ddlSelectCinema').prop('disabled', false);

        });

        $('#ddlSelectCinema').change(function() {

            $('#ddlSelectSession').prop('disabled', false);

        });

    });

    This will not hide it, but it will disable them. You might want to also add a CSS class called 'disabled' or something and apply and remove that class as you disable/enable the. This way you can style the drop downs and make them look disabled.

     

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!