Sorrido
Programmer
- Oct 17, 2001
- 6
Hello, I'm hoping someone here can help me figure this out. I'm fairly new to .NET, although not to web development in general.
I have an aspx form with a variable list of textbox controls that are dynamically created in Page_Init (according to some info passed to the page from the user), and are inserted into the asp:cell of an asp:row of an asp:table as they are created (so several levels down)
I have an asp:button control with CausesValidation set to False. Upon click, it calls a Javascript confirm function to confirm that the user is ready to submit. Upon confirmation, the button_click function in the code behind for this button manually calls Page.Validate to fire the Validation on the page's controls.
Theoretically, at least, according to all I've read, Page.Validate should fire the validation controls on the page. However, the controls are not firing.
Through my debugging, I've discovered that Page.Validate is not finding the Validation controls I plainly see in the viewsource of my aspx page. They are there to my eye, but Page.Validators.Count is still 0.
If I remove the Javascript confirmation and let the submit button call validation automatically as per usual, the validation works fine.
What's going on? Why is Page.Validate not finding my validation controls if I call it manually, but it is if I let it run automatically?
Does it have to do with the fact that the validation controls are contained within other controls on the page (Table/Row/Cell)? Do I have to iterate through each control on the page, and manually look for a validation control, or is there an easier way to solve this problem?
Things being done:
* All Validation Controls are created in Page_Init
* All Controls they are validating are created in Page_Init
Thanks to anyone who can help!
I have an aspx form with a variable list of textbox controls that are dynamically created in Page_Init (according to some info passed to the page from the user), and are inserted into the asp:cell of an asp:row of an asp:table as they are created (so several levels down)
I have an asp:button control with CausesValidation set to False. Upon click, it calls a Javascript confirm function to confirm that the user is ready to submit. Upon confirmation, the button_click function in the code behind for this button manually calls Page.Validate to fire the Validation on the page's controls.
Theoretically, at least, according to all I've read, Page.Validate should fire the validation controls on the page. However, the controls are not firing.
Through my debugging, I've discovered that Page.Validate is not finding the Validation controls I plainly see in the viewsource of my aspx page. They are there to my eye, but Page.Validators.Count is still 0.
If I remove the Javascript confirmation and let the submit button call validation automatically as per usual, the validation works fine.
What's going on? Why is Page.Validate not finding my validation controls if I call it manually, but it is if I let it run automatically?
Does it have to do with the fact that the validation controls are contained within other controls on the page (Table/Row/Cell)? Do I have to iterate through each control on the page, and manually look for a validation control, or is there an easier way to solve this problem?
Things being done:
* All Validation Controls are created in Page_Init
* All Controls they are validating are created in Page_Init
Thanks to anyone who can help!