Creating More Complex User Controls
In the previous two examples, you created simple user controls that merely expose user interface elements. Neither user control required you to write any code, nor did either provide any interactive functionality.
What if you want to encapsulate often-needed functionality as well? For example, in previous chapters on more than one occasion, you filled a DropDownList control with data. You used a SQL string with two columns, filled a DataReader or DataSet, and then either looped through the data or bound the control to the data. If you need to do this same thing often, it's a candidate for creating a user control.
Your new control, the DataDropDownList control, will contain a standard DropDownList control and ...
Get ASP.NET Developer's JumpStart now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.