Home > DeveloperSection > Forums > how to force user to select drop down list item first before continue next in C#
Chintoo Semi

Total Post:135

Points:947
Posted on    January-06-2015 10:39 PM

 ASP.Net C# 
Ratings:


 1 Reply(s)
 499  View(s)
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


john rob

Total Post:108

Points:756
Posted on    January-06-2015 10:57 PM

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.

 


Don't want to miss updates? Please click the below button!

Follow MindStick