如何从ajax组合框中使用javascript获取所选值

时间:2011-01-25 10:28:49

标签: javascript asp.net validation combobox selectedvalue

我正在试图弄清楚如何检查combobox的选定值是否不是“-1”。我使用的是customvalidatorClientValidationFunction

//A customvalidator clientValidationFunction checking if a combobox control has a valid (not -1) selectedvalue
function ValidateComboboxSelection(source, arguments) {
    var comboBoxListItems = document.getElementById('ctl00_ContentPlaceHolder1_cbxCompany_OptionList').value;
    if (null != comboBoxListItems) {
        var iValue = new Number(combobox[combobox.selectedIndex].value);
        arguments.IsValid = (iValue > -1);
    }
    else {
        arguments.IsValid = false;
    }
}

0 个答案:

没有答案