By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,299 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,299 IT Pros & Developers. It's quick & easy.

Validation block

P: n/a
Im a new bee in validation

Im just in the design phase of the project and not thinking about
having a saperate validaion block.

Just browsed through validaion block of enterprise library which is
one of the options which ill use..

I would be glad if some one help me with any of the resources or idea
of how to handle validaitons in project..Like creating saperate
component for validation.

Oct 4 '07 #1
Share this Question
Share on Google+
2 Replies

P: n/a
my custom textbox has something like this

txt.Required = true
txt.DataType = String,Integer,Money,Date, RegExp etc...
txt.RegExp = "#@$@"
txt.AutoTrim = true
txt.MinLength
txt.MaxLenght
txt.EnableValidation
txt.MinValue
txt.MaxValue
txt.ErrorBackgroundColor
txt.ErrorMessage
txt.FriendlyName
txt.AutoUpCase

i do my own custom dropdownlist, custom this custom that

all of controls, i implement IValidator

Partial Class Controls_UCTextbox

Inherits CBaseControl

Implements IValidator

Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
MyBase.OnInit(e)
Page.Validators.Add(Me)
End Sub

Protected Overrides Sub OnUnload(ByVal e As System.EventArgs)
If Not IsNothing(Page) Then
Page.Validators.Remove(Me)
End If
MyBase.OnUnload(e)
End Sub

etc....
validationsummary will get messages from ErrorMessage (IValidator
method declaration). I learn this from codeproject, and enhance it
myself

I prefer this way, easy to maintain, and boosts employee's morale.
On Oct 4, 4:07 pm, jack <gautams.m...@gmail.comwrote:
Im a new bee in validation

Im just in the design phase of the project and not thinking about
having a saperate validaion block.

Just browsed through validaion block of enterprise library which is
one of the options which ill use..

I would be glad if some one help me with any of the resources or idea
of how to handle validaitons in project..Like creating saperate
component for validation.

Oct 4 '07 #2

P: n/a
If you are going to use Validation Block, this is how I used it.

I store regular expression validations on the database extended properties
description for each field. The first line is always a description; followed
by carriage return, regular expression, carriage return, and regular
expression error message. I then used CodeSmith and wrote a template to
write my Data Transfer Object with Validation Block attributes for
StringLengthValidator, Allow Nulls, Comment Description, Regular
Expressions, etc. using the values in the database extended properties and
DB Schema.


You can also use Policy Injection with Validation Block for additional
validations.

Regards,

Brian K. Williams

"jack" <ga**********@gmail.comwrote in message
news:11*********************@n39g2000hsh.googlegro ups.com...
Im a new bee in validation

Im just in the design phase of the project and not thinking about
having a saperate validaion block.

Just browsed through validaion block of enterprise library which is
one of the options which ill use..

I would be glad if some one help me with any of the resources or idea
of how to handle validaitons in project..Like creating saperate
component for validation.

Oct 4 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.