Validating composite controls
If I set the validator Control To Validate property to the Text Box it works fine however it may not be created or rendered.
The only thing I can be guarnteed of rendering is the array or Radio Buttons.
NET's custom controls pick up where User Controls leave off, providing greater flexibility, reusability, and a better design time experience, but with some added complexity.
This sample book chapter shows you some of the most common server-control techniques. NET is its support for custom server controls and components. NET ships with dozens of built-in controls, and developers can easily extend these controls or write their own controls from scratch.
Using the scenario described in the next section, I will evolve a piece of functionality through the following stages of development: So, our task is to accept an email address in a textbox, and to validate it using a regular expression.
Progress would slow to a crawl if everything in an application that might ever be duplicated were written as a deployable control.
NET validation controls Note that in order to meet the last requirement in the scenario, this example places the validation controls in a separate column of the HTML table from the Text Box.
We'll see that while this is simple to do now, it will be a bit more complicated to allow for this functionality as we begin encapsulating the control logic.
But when should you build a control, and when should you just add the behavior to a Web form directly?
This article examines this issue, and steps through the evolution of a control from behavior on a Web form to full-fledged control. Introduction Scenario Step 1: Web Form Step 2: Web User Control Step 3: Composite Control Summary Resources Controls in Microsoft® ASP. After a control has been properly built, tested and deployed, developers can easily use it on many Web forms by dragging it onto the form and modifying its properties.