Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Triggering page validation without validation event trigger

Status
Not open for further replies.

WorkerBeeJ

Programmer
Aug 6, 2002
34
US
I have a user control that has on it a save button, which calls a save method. I'm using this same user control in a wizard, where upon advancing past that specific step with my user control, the wizard calls the same save method that I'm calling on the button click, but without the click since the save button is hidden for the wizard. My issue is with page validation. I'm able to set the CausesValidation property on the button so that I can call my custom validation methods, however, since the button is hidden when I'm using that control in the wizard, I'm not sure how to trigger the validation. So my question is, is it possible to call:

protected void Validate_Stuff(object sender, ServerValidateEventArgs e)

without the click?

Thanks,
J
 
I am not understanding your question 100%. Try putting the validation code in it's own sub. Then call that sub from the validation events as well as when the button is hidden.
 
Yes, I tried exactly that, but within the Validate_Stuff method, I'm actually using the ServerValidateEventArgs e parameter. So I need to call the method with that signature. I'm sure I could probably create new methods to do that validation, I just don't want to duplicate a lot of code. I'd rather figure out how I can call the existing method.

Thanks.
 
I figured out my solution. Calling the Page.Validate() method triggers all validation methods for visible controls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top