Validating an embedded user control at the same time as the parent validation
Posted on 2008-10-16
I have a user control that I've drag-and-dropped onto an .aspx page. Within this user control is a method called Validate. Because it's possible to drop more than one instance of the user control on this page, the validate method requires the specific name of the instance passed into it... basically it'd be called Validate(NameOfInstance).
Unfortunately, when I click the Submit button on the .aspx page the validation on the .ascx control isn't handled (thus creating the need for the Validate method to begin with). It seems that ASP.NET, after page load, handles page validation on the client-side without postback. Thus I don't see a way to tap into the aspx page's Page_Validate handler (if there is even such a thing) to call the user control's Validate method.
I hope I've been clear and thank you kindly in advance!