0

Hi I have a dropdownlist as a column within a gridview. gridview has multiple rows. In Page Source of this Page I see same Id for all the drodownlists of each row, but name is differenet. So I want to get the selected value of a dropdownlist in any nth row. So I'm trying to do the same by getElementsByName. But its giving undefind value. Why its giving undefined value and how to achieve the desired results

var DropDown= document.getElementsByName('grvRewardRulesDetails$ctl03$StartHourDropDown');
user3264676
  • 253
  • 5
  • 8
  • 20

2 Answers2

0

Try

document.getElementByID('<%= StartHourDropDown.ClientID %>')

Your DropDownList(DDL) is inside a GridView. Then you must try some other things. Try calling the Javascript on the onchange event of DDL

This link should help http://forums.asp.net/t/1550471.aspx

smilu
  • 859
  • 7
  • 30
  • 53
0

Solved Issue. getElementsByName returns array not a single value.

user3264676
  • 253
  • 5
  • 8
  • 20