how to force user to select drop down list item first before continue next in C#
2079
06-Jan-2015
for example of this website, the quick ticket session. i need to force users to select a movie first before select the Cinema
Anonymous User
06-Jan-2015You 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.