Dynamic Wizard with Dynamic Validation Controls

G

Guest

All, I have searched all around and have not yet found the answer to this nor
a solution. Hopfully it will be easy to overcome.

Here is what I am trying to do:

I'm trying to build a wizard form completely dynamic. I'm adding the
labels, textboxes, drop downs, radio buttons, etc dynamically. I am able to
add them via Page Init. Which seems to re-add every time a button or post
back is initiated. Don't know if this is the problem.

Continuing, some of the data entry or selection controls need validation. I
add a CompareFieldValidator and point all the attributes to a certain drop
down to make sure the value is Not Equal to 'Select'. I have tested this
exact validator and control in static form and this works. I've tried to
play with the other elements in the validation control configuration
properties to see if the outcome changes and nothing.

Here is the code that generates the control:

CompareFieldValidatorControl = New System.Web.UI.WebControls.CompareValidator
CompareFieldValidatorControl.ID = "rv" & ControlID
CompareFieldValidatorControl.CssClass = "formError"
CompareFieldValidatorControl.ControlToValidate = ControlID
CompareFieldValidatorControl.Operator =
ErrorHandling.ErrorMessageOperator
CompareFieldValidatorControl.ValueToCompare =
ErrorHandling.ErrorValuetoCompare
CompareFieldValidatorControl.ErrorMessage =
ErrorHandling.ErrorMessage
CompareFieldValidatorControl.Enabled = True
CompareFieldValidatorControl.EnableClientScript = True
CompareFieldValidatorControl.Display = ValidatorDisplay.Dynamic
CompareFieldValidatorControl.ToolTip = "Correct the error before
proceeding"
...Control is added to page...

I see the code that is supposed to handle the validation but the validation
does not fail. When I click the 'Next' button the next page is built as it
should, but with no validation failure. That is the problem.

I tried to go another route and I cannot yet seem to figure out how to do
this:

I tried to construct code to read each of the controls in the dynamic Wizard
for a certain step and I cannot figure out how to do that. What I would like
to do is be able to read a Typeof control of TextBox, DropDownList, and
RadioButton List. What is the syntax or code to loop through the Wizard
step's controls for a specific step?

Any help would be greatly appreciated. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Dynamic programming 3
Dynamic Array Size Problem?? 9
Dynamic Controls 0
Wizard MoveTo() method 0
Dynamic Controls 0
Dynamic Controls 1
Wizard + Validation question 0
Dynamic controls and postback. 0

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top