Dynamically changing the values in a drop down list in Visual Studio / Visual Web Developer

I have two drop down boxes.

DDAccomm & DDPrice

DDAccomm is bound to my database and gets it's values from a table.

DDPrice is hard coded

I want DDAccomm to change the values of DDPrice according to what is selected

e.g. If then selection of DDaccomm is position 1 or 2 then leave, if it's position 3 or 4 then change the values.  These values are not to come from the DB.

nickrjsmithAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JezcentralCommented:
As you know what the values will be, you can store them in arrays, and use CSS to show/hide them as required:

<html>
<head>
<script type="text/javascript">
var odd = new Array("one", "three", "five");
var even = new Array("two", "four");

function hide(numberType) {
      for (var i=0; i<numberType.length; i++) {
            document.getElementById(numberType[i]).style.display = "none";
      }
}
function show(numberType) {
      for (var i=0; i<numberType.length; i++) {
            document.getElementById(numberType[i]).style.display = "block";
      }
}
</script>
</head>
<body>
<p>Show <a href="#" onclick="hide(even); show(odd); return false;">odd numbers</a>.</p>
<p>Show <a href="#" onclick="hide(odd); show(even); return false;">even numbers</a>.</p>
<select>
      <option id="one">1</option>
      <option id="two">2</option>
      <option id="three">3</option>
      <option id="four">4</option>
      <option id="five">5</option>
</select>
</body>
</html>

J
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nickrjsmithAuthor Commented:
i used on selected index change although this solution would have worked too
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.