If you haven't read part one or two yet, you should really read them first, as this article uses many concepts that have been explained in part one and two. The final piece of interesting code in this page is inside the Save button's click handler. Get Item(contact Person Id); } else { // Create a new Contact Person my Contact Person = new Contact Person(); } my Contact Person. You saw how this worked in the previous article in this series. Active View Index = 1; break; case "phonenumbers": gv Contact Persons. If you look in the code behind, you see the following regions and the That seems like a lot of steps for something as simple as inserting an e-mail address in the database.The entire series (including this current article) can be found here: The article uses a SQL Server 2005 Express database which is easy to use in development scenarios. This code is fired when all the client side validators have done their work. At the end, when the object was saved successfully, the code calls the custom method page. Remember, though, that most of these steps take place in the framework that was developed earlier.

For more information about the translation, check out this blog post.

Part two showed you how to code the classes that were designed in part one. However, for the purpose of demonstrating n-layer design, the Calendar control is fine.

You saw how to implement the data access methods and database code and how the various classes were able to work together. Once the date has been checked, the code determines whether we're editing an existing item, or creating a new one.

You also saw how to use the API to programmatically create contact persons and their contact data and save those in a database. When that you don't want to update when you're changing an existing item.

However, writing explicit code to work with your business objects isn't always fun, and can be a cumbersome task. This way, the drop down gets filled with the values from the enum type automatically. If you'd create a brand new item using a default constructor and then set all the properties, this property might either default to or get today's date. To make it a bit easier to hide or show anything related to an e-mail address, an address or a phone number, I wrapped all the functionality in a number of different views.

Therefore, this article (part three) deals with using the business objects in a web application. NET controls like the Grid View in conjunction with the business objects. The good thing about this is you never have to worry about this list anymore. But by retrieving the existing item from the database, and only overriding what has changed, you can leave the existing data in tact. Showing, say, the phone number list, or the that is being edited, so first the BLL and then finally the DAL knows what record to update.

You'll see how you can build pages that allow you to list, create, edit and delete your contact persons and their contact data, like e-mail addresses and phone numbers. Whenever you remove or add items from the enum, this list is updated automatically. Is Valid) { Contact Person my Contact Person; if (contact Person Id 0) { // Update existing item my Contact Person = Contact Person Manager. If we're creating a new contact person, the code instantiates one using the object's default constructor : which eventually saves the object in the database and returns its new ID. However, there are a few events that are triggered in the code behind that contain some interesting code.

- I have written a new series on N-Layer design targeting ASP. How do these business objects interact with other parts of the system? As other alternatives, you could drop the entire Calendar and use three drop down instead for the year, month and day or use the new Calendar control from the Ajax Toolkit that features some cool ways to browse through the calendar.

It builds on the foundation created in this first series, but digs much deeper into concepts like Validation, Sorting, Paging, Concurrency and Security. What should these objects be capable of and how do they look. Instead, you could add an additional drop down with the years that could allow a user to quickly select the relevant year.