471,071 Members | 981 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

Dynamic Validators

I have a form where I create dynamic controls at runtime. With this, I am
adding a dynamic required field validators to each control as needed, but the
validators are not firing when I click submit. The submit button was placed
at design time and its causesvalidation property is set to true. Can someone
tell me what is missing that will make the validator fire client side? Thank

1. Code to add dynamic control works fine and I get the Id of the textbox
2. Then I see if a validator is required and add it...code below for that.
3. I have the validator display set to none because I have a validation
summary control, placed at design time, that I want to display. Is there
something I need to do to make the validation summary know the required field
validator is there?

if (required)
RequiredFieldValidator validator = new RequiredFieldValidator();
validator.ID = "validator" + controlCount.ToString();
validator.ControlToValidate = textBox.ID;
validator.ErrorMessage = "Please fill out the textbox ";
validator.Display = ValidatorDisplay.None;
Nov 6 '06 #1
0 1351

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by psparago | last post: by
7 posts views Thread by Abraham Luna | last post: by
3 posts views Thread by rgparkins | last post: by
3 posts views Thread by Wayne Sepega | last post: by
reply views Thread by Mike Collins | last post: by
2 posts views Thread by Mike Collins | last post: by
reply views Thread by Eniac | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.