This is my first article and hopefully not the last. I was looking for a good and simple article to start with. I hope this is a good start and that you guys can use my code.
The function of this article is to explain the possibilities of the
ISBN13 validation object I created. It validates a few different things specified by ISBN International. I will explain them in this article.
The basic idea behind ISBN numbers is code standard for books. For those of you who want to know more about ISBN, here is some info from Wikipedia and ISBN International.
There is another article (ASP.NET ISBN Validator) on The Code Project about ISBN validation. However, there are a few differences.
- is written in C#
- has a separate
ISBN13 validation class
- validates on grouped and ungroup
- only validates
ISBN13 numbers (this is the standard at the moment)
Using the Code
The code is very basic and straightforward. The library has a class
ISBN.ISBN13. Here is an example code to show the use of the class. As you can see, the constructor has an overload to input the ISBN directly.
ISBN.ISBN13 isbnValid = new ISBN13();
isbnValid.ISBN = "978-0-571-08989-5";
ISBN.ISBN13 isbnValid2 = new ISBN13("978-0-571-08989-5");
Validation is done directly when the ISBN is set. You can see if it is valid with the
ISBN13 also has some
static methods that are interesting. These are easy to use.
IsValidISBN(string isbn) : bool
GetISBNFormat(string isbn) : ISBNGroupingFormat
ValidateChecksum(string isbn) : bool
To use the validator control, add the
ToolboxItem. This way you can drag and drop the control. It is inherited from the
CustomValidator control. The validation is done by the
You can also add this to use the ISBN validator in your ASP form.
<%@ register assembly="ISBN" namespace="ISBN.Web" tagprefix="cc1" %>
Points of Interest
One of the most interesting points to look at is the wild
RegEx string used to validate the grouped ISBN. Is my first
RegEx this long?
- 27th March, 2007: Initial post
I started with classic ASP in 2000 after done a lot of HTML stuff. I wanted more dynamic things. Before that time I told a friend I would never start to program. To complicated. When I started to do it I was sold immediatly.
In about 2005 I started to build ASP.NET app's. Lately I liked to make .NET Forms more.