Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 6.  Learning More About Web Forms

This workshop will help reinforce the concepts covered in today's lesson. The answers can be found in Appendix A.



True or False: A user control can be used on its own.


What are the three requirements to turn an .aspx file into a user control?


Build a @ Register directive for a user control with the tag prefix and the names ACMEVBCustomControls and TextWriter, located in the shared.ascx file in a subdirectory named ucontrols.


True or False: A custom control must be compiled to be used on an ASP.NET page.


True or False: A custom control must be derived from the Object class, directly or indirectly.


Using VB.NET's property element syntax, create a simple property for a custom control called Color that stores information in viewstate.


True or False: The LoadControl method can be used to load a custom control dynamically.



Enhance the calculator exercise from Day 2 so that it resembles the Windows calculator. Include memory functions (using Session variables), clear and backspace buttons, and the additional operator buttons. Encapsulate it as a user control. This exercise can get fairly complex, but don't worry! You've learned all of the techniques you need to build it.

Hint: Building the UI should be fairly easy. Just use an HTML table. Also note that much of the functionality is duplicated. For instance, each number button should do the same thing (display a number in a text box), so they can all reference the same event handler. Finally, hidden form fields will help when you're trying to determine which numbers are being manipulated. For instance, a user presses 6, then multiply, then 7. Store the 6 in a hidden field so it's not lost after subsequent form posts.


Create a meeting planner. It should include a calendar, a text box for user entries, and a label to display the current data. Use AutoPostBack and the TextChanged event when the user enters something in the text box. Store them in session variables so that the user can return to them at a later time. When a note is added, create a label dynamically to provide feedback. Consult Appendix C to learn about the Calendar control's events and methods.


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: