我在我的jquery脚本中使用bootstrap multiselect插件。在添加任何asp.net验证程序之前,它工作正常。 Here is the scree shot.
然后我尝试如下添加范围验证器
<asp:RangeValidator ID="rvclass" runat="server" ControlToValidate="name" MinimumValue="1" MaximumValue="10" ErrorMessage="range has to be less than 10 more than 1" Type="Integer">
</asp:RangeValidator>
然后,jQuery魔术消失了(那是我所做的唯一更改)。 A screen shot here.为什么会这样?我做错了什么吗?
这是我使用多重选择的方式:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
<link href="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css" />
<script src="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/js/bootstrap-multiselect.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('[id*=lstFA]').multiselect({
includeSelectAllOption: true
});
});
</script>
<asp:ListBox ID="lstFA" runat="server" SelectionMode="Multiple" Style="margin-left: 6px;" required>
<asp:ListItem Text="Orange" Value="Orange" />
<asp:ListItem Text="Banana" Value="Banana" />
<asp:ListItem Text="Apple" Value="Apple" />
<asp:ListItem Text="Watermelon" Value="Watermelon" />
</asp:ListBox>