I have a dropdown list with a piece of code that is run when the value is changed:
<select name="SList" onchange="javascript:setTimeout('__doPostBack(\'SList\',\'\')', 0)" id="SList">
Everything works fine when manually done. As an option is selected, the onchange code is called.
The problem begins when I try to change the selected value using a piece of Javscript. I want to be able to automatically change the selected option using JS, whilst still having the onchange code called, exactly as if done manually.
I try calling this:
form.SList.value = "33";
The right option is selected, but the onchange code does not get called. So then I try doing this:
form.SList.value = "33";
javascript:setTimeout('__doPostBack(\'SList\',\'\')', 0);
The right value is not selected and nothing happens.
FYI, the code is done in ASP.NET and Javascript.
What can I run to change the selected option whilst still calling the onchange code?