1

My goal is to update 3, 4 dropdown list which is updated after choosing an item from the first dropdown list. Any help would be appreciated. I can't detect when start ajax activity in webbrowser control. I've tried instructions in this thread with no success, implemented the following class: HTML:

<select id="CityListMember" name="CityListMember"><option value="">City</option>
<option value="1">City 1</option>
<option value="2">City 1</option>
<option value="3">City 3</option>
<option value="4">City 4</option>
</select>
<select class="last" id="DistrictListMember" name="DistrictListMember" param="qh"><option value="">District</option>
<option value="11">District 1</option>
<option value="12">District 2</option>
<option value="13">District 3</option>
</select>
<select class="last" id="StreetListMember" name="StreetListMember"><option value="">Đường</option>
<option value="a">Street 1</option>
<option value="b">Street 2</option>
<option value="c">Street 3 </option
</select>
Jason Aller
  • 3,541
  • 28
  • 38
  • 38

1 Answers1

1

Use the onselectionchanged event to call your ajax activity to fetch the data. Add the dropdown options in the same function.

E.g. Update the html dropdown code as below

<select id="CityListMember" name="CityListMember" onselectionchanged="fnCitySelected();">

Then in same HTML file, add a function like this:

<Script Type="text\javascript">
function fnCitySelected(){
//get list of district using ajax call
//add options to district dropdown 
</Script>

Edit: Note this is for the case where you need to get the data from database. If the data is very small, and can be loaded before hand, then you should use the jquery method posted in comment by Norman. How to populate a cascading Dropdown with JQuery

jitendragarg
  • 945
  • 1
  • 14
  • 54