Ankita Singh

Ankita Singh

  • 2k
  • 159
  • 14k

onchage event thorugh cascading dropdown list

Mar 5 2018 3:51 AM
<script type="text/javascript">
function change() {
debugger
var DropdownList = document.getElementById('<%=ACan.ClientID %>');
var SelectedIndex = DropdownList.selectedIndex;
var divtenper = document.getElementById('divtenper');
var divyear10 = document.getElementById('divyear10');
var divpertwelth = document.getElementById('divpertwelth');
var divyearof12 = document.getElementById('divyearof12');
var divgraper = document.getElementById('divgraper');
var divyearofgra = document.getElementById('divyearofgra');
//divtenper.style.display = Course.value == "1" ? "block" : "none";
if (SelectedIndex == 1) {
divpertwelth.style.display = "none";
divyearof12.style.display = "none";
divgraper.style.display = "none";
divyearofgra.style.display = "none";
divyear10.style.display = "block";
divtenper.style.display = "block";
}
else if (SelectedIndex == 2) {
divpertwelth.style.display = "block";
divyearof12.style.display = "block";
divyear10.style.display = "none";
divtenper.style.display = "none";
divgraper.style.display = "none";
divyearofgra.style.display = "none";
}
else if (SelectedIndex == 3) {
divgraper.style.display = "block";
divyearofgra.style.display = "block";
divpertwelth.style.display = "none";
divyearof12.style.display = "none";
divyear10.style.display = "none";
divtenper.style.display = "none";
}
// return true;
}
 
if i use onchange event without cascading then value come selectedindex=1 not work for selectedindex=2 or 3 then i wanna do it with cascading dropdown.....

Answers (2)