Chapter 13: Updating Master-Details Tables


Overview

In Chapter 12, you worked with master-details tables in the form of slideshows. The Slideshows table is the master table, containing the slideshow names (code, abbreviation, or number) and the slideshow titles. The Slides table is the details table, containing entries for individual slides, including the URL, caption, and date. The tables are related via the slideshow name that they have in common. All the entries in the Slides table with the same SlideshowName value are related and are considered detail records for a single slideshow master record.

When you created the database structure in Chapter 12 for entering master records in the Slideshows table and detail entries in the Slides table, you entered data using the comparatively primitive data-editing tools built into Web Matrix. But using Web Matrix tools to enter data into a database isn t practical for anyone but you, the Web application developer. You might be creating an application for someone else or you might simply want to allow others to access your site and enter slide information perhaps you re creating an application in which anyone in your family can enter slides. In this chapter, therefore, I ll show you how to create Web pages that act as data-entry forms for your slide information. You ll create two pages: one to enter master records for the Slideshows table, and one to enter, edit, and delete individual detail entries in the Slides table. The pages will be linked in such a way that you won t have to remember the slideshow name each time you enter an individual slide. Creating these pages will teach you a technique for entering records into any master- details table combination. Along the way, you ll learn to put the MxDataGrid control through its paces and explore more of its considerable capabilities.

I ll tell you up front that even though the pages you create in this chapter will offer you an improved way to enter master-details information into the database, the pages still aren t optimal. One problem, as I ve said before, is that databases are complex, and unfortunately, Web Matrix doesn t give you a sophisticated way to configure your database. For more information about the limitations of the pages you ll create in this chapter, see the section Maintaining Master-Details Integrity later in this chapter.

Another limitation of the pages you ll create in this chapter is that they don t include any facility for making sure that only authorized users can enter and edit slideshow information. If your application will be available to the public, you probably want to consider adding some authentication to it. I ll discuss security and authentication in Appendix A.

Now that you ve got a general idea of what you re going to create in this chapter, let s get started with creating a page for entering slideshow information.




Microsoft ASP. NET Web Matrix Starter Kit
Microsoft ASP.NET Web Matrix Starter Kit (Bpg-Other)
ISBN: 0735618569
EAN: 2147483647
Year: 2003
Pages: 169
Authors: Mike Pope

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net