9.5. Exercises

  1. To make the ContactForm.ascx user control even more reusable, you can create a string property such as PageDescription on it that allows you to set the name of the page that uses the control. You then add this string to the declaration of the control in the containing page. Finally, you can add the description to the subject of the message that you send. This way, you can see from what page the contact form was called. What code do you need to write to make this happen?

  2. Why is it so important that you check the value of the IsValid property of the Page when processing data? What can happen if you forget to make this check?

  3. What's the difference in behavior between the To and the From property of the MailMessage class?

  4. When you use a CustomValidator, you can write validation code at the client and at the server. How do you tell the ASP.NET runtime what client-side validation method to call during the validation process?

  5. How do you tell the validation mechanism that validation succeeded or failed in your CustomValidator routines?

Get Beginning ASP.NET 3.5: In C# and VB 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.