Showing posts with label webforms. Show all posts
Showing posts with label webforms. Show all posts

Monday, April 8, 2013

Improved compiletime supported validators

After a the initial post on the compile-time supporting webform validators, a few itches started to surface. Mainly the extendability and cleanliness. With some slight changes it was possible to categorize the validators (thus enforcing more of the Single Responsibility Principle).

Usage


The following code demonstrates the usage of this API. Note that there are breaking changes if you are replacing the previous version.
protected override void OnInit(EventArgs e)
{
    base.OnInit(e);

    this.UsernameField.Validation().RequiredField("username");
    this.PasswordField.Validation().RequiredField("password");
}
Read the original post for implementation details.

Thursday, January 6, 2011

ASP.NET Compile Time Supported Validators

UPDATED VERSION

Click here for the latest blog.

With.NET 3.5 extension methods were introduced, these methods provide a great way built features into 'closed' objects or doing a way of IOC.

Either way, the following example shows the usages a 'simple' validation framework. It provides extensions to validate web controls with compile time support. Which is quiet nice if don't have to write any markup code anymore.

Wednesday, November 10, 2010

Creating compile time supported URLs

COVERAGE: ASP.Net C#, Microsoft AntiXss, LINQ, CuttingEdge Conditions.

When it comes to ASP.Net and linking to other pages it's a very lose system. Which is strange when you think about it. We're working in assemblies here, pages are classes and classes can have 'relations' with other classes and be supported by the compiler. Yet there are a lot of NavigateUrl's being filled with strings from either code or markup. Brrr.