Using ASP.NET validators to validate Composite Control data

trae4nato

New Member
Background: I have a toolset of CompositeControls that I use to build forms. The controls themselves tie in to some jquery validation for basic validation tasks.Problem: I want to make the validation of these CompositeControls more flexible by allowing developers to use the ASP.NET validators (i.e. RegExValidator, RequiredFieldValidator, CustomValidator, etc) to validate the data in one of my CompositeControls.Example: I'd like the developers to be able to do something like this:\[code\]<asp:ValidationSummary runat=server HeaderText="There were errors on the page:" /><custom:TextBox id='SomeTextBox' Label='Enter Name Here:' text='' runat='server' /><asp:RequiredFieldValidator runat=server ControlToValidate=SomeTextBox ErrorMessage="Name is required."> *</asp:RequiredFieldValidator>\[/code\]I have added the "ValidationProperty" to the composite textbox, but the RequiredFieldValidator (or any ofthe other validators) don't seem to recognize the textbox or the data coming from it. The textbox (and all other custom CompositeControls I built) inherit CompositeControl, have the attribute "ValidationProperty" set to the public property that exposes the data element of the control, and contain a "string ValidationGroup" property as well. Question: Does anybody know what else or what specifically a Composite Control requires to play nice with the ASP.NET validators (I'd prefer avoiding including instances of all the validator types in the composite control, unless of course that is necessary)?
 
Back
Top