문제

I have a aspxcombobox with ID="comboSubjectCategory", can I get the selected value/text using javascript function? thanks lot...I tried this but it does not works.

function getValue() {
   var combo = document.getElementById('comboSubjectCategory').value;
   alert(combo);
}
도움이 되었습니까?

해결책

The ASPxComboBox is not a simple HTML element. In the browser, it is represented by the ASPxClientComboBox Class. Use its GetValue, GetText or GetSelectedItem methods to obtain the selected value.

You can obtain the ASPxClientComboBox instance by the name assigned to the ClientInstanceName property of the ASPxComboBox control.

See Also: Client-Side Functionality

다른 팁

var combo = document.getElementById('<%= comboSubjectCategory.ClientID %>');
var val = combo.options[combo.selectedIndex].value;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top