[sourcecode language="csharp"]
<asp:CheckBoxList ID="groupsList" runat="server" DataSourceID="GroupsDS" DataTextField="Name" DataValueField="Id" CssClass="span6 m-wrap groupsList" RepeatLayout="UnorderedList"></asp:CheckBoxList>
<asp:CustomValidator ID="CustomValidator1" ErrorMessage="Please select at least one group."
ForeColor="Red" ClientValidationFunction="ValidateCheckBoxList" runat="server" />
<asp:SqlDataSource runat="server" ID="GroupsDS" ConnectionString='<%$ ConnectionStrings:flexi_stocky %>' SelectCommand="SELECT * FROM [Groups]"></asp:SqlDataSource>
[/sourcecode]
[sourcecode language="javascript"]
<script type="text/javascript">
function ValidateCheckBoxList(sender, args) {
var checkBoxList = document.getElementById("<%=groupsList.ClientID %>");
var checkboxes = checkBoxList.getElementsByTagName("input");
var isValid = false;
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].checked) {
isValid = true;
break;
}
}
args.IsValid = isValid;
}
</script>
[/sourcecode]
Subscribe to:
Post Comments (Atom)
How to enable CORS in Laravel 5
https://www.youtube.com/watch?v=PozYTvmgcVE 1. Add middleware php artisan make:middleware Cors return $next($request) ->header('Acces...
-
< Requirements Java Development Kit (JDK) NetBeans IDE Apache Axis 2 Apache Tomcat Server Main Topics Setup Development Environ...
-
Download Sourcecode [sourcecode language="csharp"] using System; using System.Collections.Generic; using System.Linq; using System...
No comments:
Post a Comment