-
22 September 2008
The Three Steps of Building an ASP.NET Validator Control

The standard ASP.NET validator controls such as the
RequiredFieldValidatoror theRegularExpressionValidatordo not cover all validation requirements, so usually developers tend to create aCustomValidatorfor such scenarios.A major problem with the
CustomValidatoris reusability, as if you wanted to use the validator in another project then there would be some copying and pasting and code duplication, then you have to maintain multiple versions of the same control.The solution, as you have guessed from the title, is to build your own validator control when possible to promote reusability.
In this post I will be showing you in three simple steps how to build an ASP.NET validator control and take credit card number format check to show by example. I will also be building the architecture so that your validator and other validators that you will develop in the future could be as reusable as possible.
How to Check a Credit Card Format
Luhn check is an algorithm that checks if a credit card number is valid (format wise), so in practice, before you even think of doing any further processing on the credit card, this check should be satisfied.
Tagged under: | 7 comments -
16 September 2008
Three Rules That ASP.NET Developers Should Know About SEO

Search engines optimisation, SEO, is an evolving ‘science’ and it keeps changing on purpose. Most articles that I read which involve both SEO and ASP.NET usually focus on how to programatically set the meta keywords tag and they tend to make it look like very important while, as of today, it has minimal effect on optimisation.
Generally, web developers tend to turn the blind eye when it comes to SEO while a great part of SEO should be done by developers. Here are three rules for .NET developers to follow while building a site:
Tagged under: | 9 comments -
15 February 2008
Check Validator – An ASP.NET Validator Control

While some developers assume that the classical ASP.NET validators support check boxes and radio buttons, this isn’t the case! There is a logical explanation for this; there is nothing much to check, the checkbox can only be checked or unchecked so what do you want to validate?
In some cases you might want to display an error if a check box or a radio button is unchecked, e.g. terms and conditions check box, if so, then this is the right validator for you. Read on if you are interested in the bits and pieces of how the control works or skip to the “Using The Validator” section if you are just interested in using it.
Tagged under: | 11 comments -
11 February 2008
Session Keep-Alive Web Control

Session expiration in ASP.NET is a nasty problem. Imagine yourself filling a long form, hitting submit then boom you get the login page! That happened to me before and probably happened to you.
This problem doesn’t have an out-of-box solution in ASP.NET and there are different appraoches to solve it.
- Increasing the session time out. Probably you are aware of the cons of this problem which are mainly consuming more server resources.
- Having an image or an iframe that refreshes regularly and requests the server. This approach is a per page approach and you can select the pages to implement it on.
Personally, I’ve been using the second approach for a long time and didn’t have any problem with it. However, I made it more reusable, not to mention “cleaner”, by making it a web control.
If you are just interested in using the control then you can skip to the last section “Using the Control.”
Tagged under: | 8 comments
-
Recent Posts
-
Tags Cloud
© Copyright 2007 - 2010, all rights reserved for Adam Tibi
top