我只是想获得一个与 asp.net 母版页一起工作的淘汰赛绑定下拉菜单。在母版页中,我有对 jquery 和淘汰赛的脚本引用。在示例内容页面中,我有以下内容,但从未填充选择控件。我错过了什么?
<asp:content id="Content1" contentplaceholderid="contentBody" runat="server">
<select data-bind="options: docTypes ,
optionsCaption: 'Choose document type',
optionsText: 'name',
value: chosenDocType"></select>
<script>
$(function(){
function emailViewModel() {
this.docTypes = [
{ name: "1" },
{ name: "2" },
{ name: "3" }
];
this.chosenDocType = ko.observable();
}
ko.applyBindings(emailViewModel);
});
</script>
</asp:content>