In the designer / .aspx:
<asp:CheckBox ID="chkAgree" runat="server" />I agree to the <a href="#" class="link-blue"> Terms of Service</a> and <a href="#" class="link-blue">Privacy Policy</a>
<asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ValidateCheckBox" CssClass="field_validation" ErrorMessage="Please accept our Terms of Service in order to avail our services." ></asp:CustomValidator>
and the Javascript code:
<script type="text/javascript">
function ValidateCheckBox(sender, args) {
if (document.getElementById("<%=chkAgree.ClientID %>").checked == true)
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
</script>
Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts
Wednesday, May 22, 2013
Wednesday, October 24, 2012
Get the Sum of a Particular DataTable Column
Use the DataTable.Compute method:
Use empty string if filter expression is not needed.
DataTable table;
table = dataSet.Tables["Orders"];
// Declare an object variable.
object sumObject;
sumObject = table.Compute("Sum(Total)", "EmpID = 5");
where "EmpID = 5" is a filter expression.
Wednesday, October 10, 2012
Convert PagedCollectionView to Original Source
ObservableCollection<SavedReport> obvColSavedReports = new ObservableCollection<SavedReport>();
foreach (var savedReport in ((PagedCollectionView)dataGrid1.ItemsSource).SourceCollection)
{
SavedReport sr = (SavedReport)savedReport;
if (sr.IsSelected)
obvColSavedReports.Add(sr);
}
See the bold text above? That's it!
foreach (var savedReport in ((PagedCollectionView)dataGrid1.ItemsSource).SourceCollection)
{
SavedReport sr = (SavedReport)savedReport;
if (sr.IsSelected)
obvColSavedReports.Add(sr);
}
See the bold text above? That's it!
Sunday, September 12, 2010
Reflections: List the properties and values of a class
PropertyInfo[] props = typeof(ScheduledReport).GetProperties();
for (int i = 0; i <>
{
sbBody.Append(props[i].Name + " : " + props[i].GetValue(report, null) + "\n");
}
Subscribe to:
Posts (Atom)