I am trying to get the SelectedValue from the Ajax Control Toolkit ComboBox. I noticed that the rendered HTML items for the combobox are bulletlists (<li>) items. A hiddenfield is rendered but this object holds the selectedindex not the selectedvalue. I need the selectedvalue to do some javascript programming. The combobox is as follows:
<asp:ComboBox ID="ddlTest" Enabled="false" runat="server">
<asp:ListItem Text="Red" Value="1"></asp:ListItem>
<asp:ListItem Text="White" Value="2"></asp:ListItem>
<asp:ListItem Text="Black" Value="3"></asp:ListItem>
</asp:ComboBox>
P.S. I have a databound combobox.
Here is the code snippet that I am using:
var dropDownList = document.getElementById(drlElementID);
var comboTextBox = dropDownList.control.get_textBoxControl();
var hiddenFieldID = dropDownList.control.get_hiddenFieldControl();
hiddenField.value gives the SelectedIndex and not the SelectedValue.
Any help on this is highly appreciated.