I do bind when i create them.
Loop
Create textbox.id = 1
Create requiredValidator.id = "req"&1
requiredValidator.controlToValidate = 1
requiredValidator.enabled = false
I set enabled to false because the FirstName is not required UNLESS you you
enter text into the LastName field. LastName is not required at all. In my
example you can leave both first name and last name empty, but if you enter a
last name, then you must enter a first name.
So, I have lastname autopostback, (I can't figure out how to capture the
autopost back to enable the fistname validator).
Next,
In my example I use FirstName and LastName, but in my database I have
something like pub0, pub1, pub2, pub3, pub4
so I wanted something generic to capture the postback, then I can strip the
string, get the number, then enable the corresponding, requiredFieldValidator.
"Lucas Tam" wrote:
"=?Utf-8?B?TFU=?=" <LU@discussions.microsoft.com> wrote in
news:10**********************************@microsof t.com:
If user enters LastName, then FirstName is required.
I can get LastName textbox to autopostback, but how do I create a sub
that will capture the autopostback and then enable the
requiredFieldValidator. I have many textboxes in the database so I
need something that is generic?
Why don't you bind the requirefieldvalidator when you created it the
first time?
So your loop:
Create Control
Create Validator
Bind Validator to Control
On postback:
Check validators
Valid
Continue
Else
Display Current Page
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/