CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of validation
//******************************//
//Prevent wrong input for mobile
//******************************//
 $("#Mobile").keydown(function (event) 
{
    // Allow: backspace, delete, tab and escape
    if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 ||
    // Allow: Ctrl+A
    (event.keyCode == 65 && event.ctrlKey === true) ||
    // Allow: home, end, left, right
by Egli   May 14, 2012 @ 11:43pm
13 Views
no comments
 
//Remeber to use Html.TextBoxFor Html Helper with Html class attribute
 
            // a custom method for validating the Departure and Arrival Dates
            $.validator.addMethod('dateBeginEnd', function () {
                return new Date($('#DepartureDt').val()) < new Date($('#ArrivalDt').val());
            }, 'Depature date must be before Arrival date.');
 
            // a new class rule to group all three methods
            $.validator.addClassRules({
                requiredBeginEndDate: { required: true, date: true, dateBeginEnd: true }
17 Views
no comments
 
<%@ Page Title="" Language="C#" MasterPageFile="~/Miso1.Master" AutoEventWireup="true" CodeBehind="Currency.aspx.cs" Inherits="WebApplication1.Currency" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="server">
    <script type="text/javascript" language="javascript">
 
        $(document).ready(function () {
        });
 
 
        String.prototype.replaceAll = function (str1, str2, ignore) {
            return this.replace(new RegExp(str1.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g, "\\$&"), (ignore ? "gi" : "g")), (typeof (str2) == "string") ? str2.replace(/\$/g, "$$$$") : str2);
by Fred Peters   April 03, 2012 @ 6:44am
48 Views
no comments
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
 
        <script type="text/javascript" src="JavaScript/jquery-1.4.1.min.js"></script>
        
        <script type="text/javascript" language="javascript">
 
        String.prototype.replaceAll = function (str1, str2, ignore) {
by Fred Peters   April 03, 2012 @ 6:42am
35 Views
no comments
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
 
        <script type="text/javascript" src="JavaScript/jquery-1.4.1.min.js"></script>
        
        <script type="text/javascript" language="javascript">
 
        String.prototype.replaceAll = function (str1, str2, ignore) {
by Fred Peters   March 30, 2012 @ 11:00am
40 Views
no comments
 
function IsPageValid() 
{
    var validated = Page_ClientValidate('UserComments');
 
    if (validated) 
    {
        //Its valid
        return true;
    }
    else 
by Egli   February 09, 2012 @ 4:04pm
69 Views
no comments
 
C#
public static class UnityContainerExtensions
{
    public static void AssertMappingsAreValid(this IUnityContainer container)
    {            
        foreach (var registration in container.Registrations)
        {
            container.Resolve(registration.RegisteredType, registration.Name);
        }
    }
}
by Byteflux   October 04, 2011 @ 10:36pm
141 Views
no comments
 
C#
 [TestMethod]
 public void TestRenamedbContextMenu()
 {
     dbContext context = new dbContext();
 
     // Load the first menu
     Menu menu = context.Menus.FirstOrDefault();
 
     // force a change
     menu.ModifiedOn = DateTime.Now;
by Rick Strahl   September 27, 2011 @ 4:43am
281 Views
no comments
 
C#
/// <summary>
/// Validates the email.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.Web.UI.WebControls.ServerValidateEventArgs"/> instance containing the event data.</param>
/// <param name="page">The calling <see cref="System.Web.UI.Page" /> web page.</param>
public void ValidateEmail(object sender, ServerValidateEventArgs e, Page page)
{
    var emailAddress = page.FindControl("emailAddress") as TextBox;
    var firstName = page.FindControl("firstName") as TextBox;
by Dean Weber   September 12, 2011 @ 7:19am
63 Views
no comments
 
C#
/// <summary>
/// An entry that can be either a single ip or a range
/// </summary>
public class IpEntry
{
    public string StartRange { get; set; }
 
    public string EndRange { get; set; }
 
    public bool IsRange
by rawbert   January 17, 2011 @ 1:29am
475 Views
2 comments
 
C#
public static IEnumerable<ValidationResult> Validate(object component)
{
    return from descriptor in TypeDescriptor.GetProperties(component).Cast<PropertyDescriptor>()
            from validation in descriptor.Attributes.OfType<System.ComponentModel.DataAnnotations.ValidationAttribute>()
            where !validation.IsValid(descriptor.GetValue(component))
            select new ValidationResult(
                validation.ErrorMessage ?? string.Format(CultureInfo.CurrentUICulture, "{0} validation failed.",     
                validation.GetType().Name),
                new[] { descriptor.Name });
}
by Arjan   June 26, 2010 @ 10:28am
278 Views
no comments
 
C#
//Check for errors
bool controlHassErrors = Validation.GetHasError(ProjectNameTextBox);
//Update control
ProjectNameTextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
 
//Set Language
private void Application_Startup(object sender, StartupEventArgs e)
{
   CultureInfo culture = new CultureInfo("nl-NL");
   Thread.CurrentThread.CurrentCulture = culture;
by Arjan   March 24, 2010 @ 11:38am
325 Views
no comments
 
C#
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MensajeGeneralError.ascx.cs"
    Inherits="Syllabus_PL.UserControls.WebUserControl1" %>
<table cellspacing="0" cellpadding="0" class="cf ve">
    <tbody>
        <tr>
            <td class="vj">
            </td>
            <td class="vi" />
            <td class="vk" />
        </tr>
by Claudia Hidalgo   August 10, 2009 @ 12:56pm
250 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate