Jan 18, 2010

2:14 AM - No comments

A deadly node in asp DropDownList

Suppose that you want to use java script to manipulate an asp drowpdown list instance.
Okie, it seems nothing simpler than that. Do a search (in case you do not remember the client functions name), you have a list of functions name like this page: http://www.dotnetfunda.com/tutorials/controls/dropdownlist.aspx
Make a simple code in your page:
var drpValuationName = FindSelectBoxByID("drpValuationName");
drpValuationName.SelectedIndex = 0;
alert(drpValuationName.SelectedValue);
But your dropdown never fires as you want it be ! Why ? Just a silly syntax error, try to replace "SelectedIndex" by "selectedIndex" :))
I dont know why javascript distinguishs uppercase from lowercase in this case. I'm using .NET Framworks 3.5. Anyway, it swallows me a couple of houses before I discover it. It's a bloody experience :D

0 comments:

Post a Comment