Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > dynamically adding validators

Reply
Thread Tools

dynamically adding validators

 
 
jsh02_nova
Guest
Posts: n/a
 
      06-05-2004
I'm adding validators dynamically to a page with the following code:

MyVal = New RegularExpressionValidator
With MyVal
.ControlToValidate = tbAttrValue.Id
.ValidationExpression = "(\w){1,2}"
.ErrorMessage = "Warning W.R."
.Display = ValidatorDisplay.Dynamic
End With
Me.Page.Validators.Add(MyVal)

The project compiles and runs however, when I submit the page I get an
'Object reference not set to an instance of an object.' exception. Has
anybody else run across this problem, if so what am I missing?

thx


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting Controls Dynamically - with Validators Also Added Dynamically Jeffrey Todd ASP .Net 1 06-02-2005 04:33 PM
Regular Expression validators NOT working, Required Field validators ARE working Ratman ASP .Net 0 09-14-2004 09:36 PM
Dynamically created validators - server side validation not working. Tony ASP .Net 1 12-12-2003 11:58 AM
Dynamically generating control validators -=Chris=- ASP .Net 2 11-09-2003 06:30 AM
dynamically add controls and validators - always false Christian H ASP .Net 2 07-23-2003 09:07 AM



Advertisments