我有一個asp dropdownlist <asp:DropDownList ID="ddIndProvince" data-style="btn-default" CssClass="form-control input" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddIndProvince_SelectedIndexChanged" TabIndex="8"></asp:DropDownList>
頁面加載事件我在索引0處插入了「--Select--」項目。 現在我遇到了問題,我正在使用引導驗證器。它的返回值對「 - 選擇 - 」項有效。像下面的圖片。 使用引導驗證器驗證ASP.NET Dropdownlist控件
如何this.Below我們我當前的腳本
<script type="text/javascript">
$(document).ready(function() {
$('#form1').bootstrapValidator({
container: '#messages',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
<%=ddIndProvince.UniqueID%>:{
validators:{
notEmpty:{
messages:'please select province'
}
}
}
}
});
});
</script>
很好用!謝了哥們! –