|
-
July 3rd, 2007, 09:03 AM
#3
Re: Validation in user controls
I've partially fixed the problem. I restructured the entire page so that there are no user controls with controls inside them. Everything is now on the main page. The Page_Load event calls routines which dynamically creates all the controls and sets their values (if any). I now have two RequiredFieldValidators each monitoring the ID property of dropdownlists. When I click the "save" LinkButton, the error messages shows up if one of the dropdownlists is not selected. So far so good.
The problem I'm haviong now is that when the "Cancel" button is clicked, the errors are still displayed, and the page won't change. I have the "Save" button set to CausesValidation = true, and all other buttons have CausesValidation = false. I also set the RequiredFieldValidators set to IsValid = true when I create them.
I do notice that when I click the cancel button that Page_Load is called again just before the error messages come on. Does that make any difference?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|