code_junkie

I want to add items to an ASP.Net combobox using Javascript

Nov 12th, 2011
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. //Fill the years (counting 100 from the first)
  2. function fillvarYear() {
  3. var dt = $('#txtBDate').val();
  4. dt = dt.toString().substring(6);
  5.  
  6. var ye = parseInt(dt);
  7.  
  8. //Loop and add the next 100 years from the birth year to the combo
  9. for (var j = 1; j <= 100; j++) {
  10. ye += 1; //Add one year to the year count
  11.  
  12. var opt = document.createElement("OPTION");
  13. opt.text = ye;
  14. opt.value = ye;
  15. document.form1.ddlYear.add(opt);
  16. }
  17. }
  18.  
  19. string selectedValue = Request.Params[combobox.UniqueId]
Add Comment
Please, Sign In to add comment