Could someone help: I am trying to get the selected value of an ajax control toolkit ComboBox control. I have the ComboBox databound to a collection of objects. I would like to determin if the user has selected a value in the ComboBox or if it is still
set to the default value of -1. I have tried the javascript below, but I keep getting this error.
0x800a138f - JavaScript runtime error: Unable to get property 'undefined' of undefined or null reference
var cboProdSearch = document.getElementById('<%= cboProdSearch.ClientID %>');
var selectedvalue = cboProdSearch.options[cboProdSearch.selectedIndex].value; // fails on this line
Member
23 Points
306 Posts
How do you get Selected value of combobox using javascript
Oct 29, 2013 03:08 PM|duckkiller53|LINK
Could someone help: I am trying to get the selected value of an ajax control toolkit ComboBox control. I have the ComboBox databound to a collection of objects. I would like to determin if the user has selected a value in the ComboBox or if it is still set to the default value of -1. I have tried the javascript below, but I keep getting this error.
0x800a138f - JavaScript runtime error: Unable to get property 'undefined' of undefined or null reference
Any help would be major appreaciated.
Thanks.
Duckkiller53@gmail.com
All-Star
30411 Points
3628 Posts
Re: How do you get Selected value of combobox using javascript
Oct 31, 2013 05:33 AM|Fuxiang Zhang - MSFT|LINK
Hi duckkiller53,
Thanks for the post.
From your description, I see that you want to get the seleted value of ajax control ComboBox.
Please try below code.
If any doubt, please feel free to back. Thanks.
Best Regards!
Member
23 Points
306 Posts
Re: How do you get Selected value of combobox using javascript
Oct 31, 2013 10:42 AM|duckkiller53|LINK
Thanks for the help. I could not find anything on the web to do that!
Duckkiller53@gmail.com