Hi,
Wondering if you could help. I'm struggling to get a value from a ComboBox. I have the following ComboBox set up:
<
sq8:ComboBox
runat
=
"server"
ID
=
"cboAgree"
OnClientSelectedIndexChanged
=
"onSelectedIndexChanged"
><
Items
>
<
sq8:ComboBoxItem
runat
=
"server"
Text
=
"Agree"
Value
=
"Agree"
></
sq8:ComboBoxItem
>
<
sq8:ComboBoxItem
runat
=
"server"
Text
=
"Disagree"
Value
=
"Disagree"
></
sq8:ComboBoxItem
>
</
Items
>
</
sq8:ComboBox
>
<
sq:BindableControl
runat
=
"server"
TargetControlID
=
"cboAgree"
DataField
=
"Agreement"
></
sq:BindableControl
>
And the following JavaScript to get the value:
<
script
type
=
"text/javascript"
>
Sys.Application.add_load(FormLoad)
function FormLoad()
{
onSelectedIndexChanged(true);
}
function onSelectedIndexChanged(sender, eventArgs)
{
var commentsGrid = document.getElementById("comms");
commentsGrid.style.display = "none";
var item = eventArgs.get_item();
if (item == "Disagree") {
commentsGrid.style.display = "block";
} else {
commentsGrid.style.display = "none";
}
}
</
script
>
I get back the following error - "Uncaught TypeError: Cannot read property 'get_item' of undefined"
I have looked at the threads about getting ComboBox values on this forum but just can't seem to get this working.
When the value "Disagree" is selected from the combobox (id of the ComboBox is cboAgree) i want the grid to show. And when Agree is selected, i want the grid to disappear.
Could anyone steer me in the right direction? Thanks!