Home

Wiley Dreamweaver 8 All-in-One Desk Reference For Dummies

image

Contents

1. You can use any field that identifies the record for expanding the detail of the record T Click the Change Column Type button 5 Select Hyperlink from the pop up menu The Hyperlink Column dialog box appears 6 In the Hyperlink Text section specify the text that you want to dis play in the hyperlink column 70 4 Developing Master and Detail Pages for ASP NET Here are your choices e Static Text Select this radio button if you want to use a generic description for this column Enter text for the link such as Details Data Field Select this radio button if you want to add text for a link based on a hyperlink column Then from the drop down list select a data field in your dataset In the example we selected the 1ast name column as shown in Figure 1 12 Format String This field is automatically generated and shows the format of the URL text Ea Figure 1 12 This Hyperlink Hyperlink Column g Column Tiie last none dialog box Hyperlink text o Static text Cancel uses the Data field last_name v first_ Format string name as the Urked page O Static URL t first name x arameter soon eS Y ju d Format string detail_net asp first_name 0 detail_ net asp as the page 7 In the Linked Page section specify the URL for the hyperlink column text Here are your choices e Static Text Select this radio button if you want to use a generic link for this column E
2. columns that you need to create your detail page Typically you show more columns on the detail page than on the master page For the example in this chapter we created an Employee recordset and included all the columns in the Employee table see Table 1 1 3 Save your changes to the master page The new recordset appears in the Bindings panel and a small yellow code indicator is inserted in the Document window as shown in Figure 1 1 This page allows a listing of employees to display on the master page which provides links to detail pages with more data than the master page Building Master and Detail Pages in One Operation 693 Code indicator New recordset Book IX e z 2 a cromedia Dreamweaver 8 CA lnetpub wwwrootUnnamed Site 5imaster_detail php XHTML n Delebeses LUS Server Bet iota Components x document toos __ Forms Edit View Insert dify Text Commands Site Window Help L eau safieg I812q pue Ja seyy Guipying Figure 1 1 The Document window WE orovest phe with a Server Marup dome fero php myscl select cb M pueerm phy Par D k recordset Samy Employes Recordsct SELECT ponte nied ys b3rz o defined Ren i r macta da fictione Employee Recordset mysc 4 Choose Insert Application Objects Master Detail Page Set to insert the master and detail pages all in one operation The Insert Master Detail Page Set dialog box appears You specify the
3. example the key field is employee id as shown in Figure 1 6 Figure 1 6 Configuring H EE Ee the URL ecordset empioyee id l 7 gt MEA parameter and its recordset 8 Click in the Value column and then click the Dynamic lightning bolt button The Dynamic Data dialog box displays This is where you select the column from the recordset 9 Expand the recordset click the key field and then click OK In this case the key field is employee_id After you click OK the Parameters dialog box displays the new param eter and the code that places it into the page dynamically as shown in Figure 1 6 10 Click OK to close the Parameters dialog box The URL field in the Select File dialog box is pre populated with the new parameter Re Each dynamic page type has different code that appears because each amp programming language uses a slightly different syntax to display a URL variable dynamically Fortunately because Dreamweaver is generating the code for you you don t need to know the syntax differences 11 Click OK to close the Select File dialog box You return to the Document window The name of the detail page appears in the Link field in the Properties inspector The placeholder for the dynamic content is now a link are Figure 1 7 The Recordset dialog box after selecting a database table 12 Developing Master and Detail Pages Block by Block 699 Save your changes to the master page You
4. now have a complete master page Read on to find out how make the detail page Building detail pages To create a detail page for PHP ASP JSP and ColdFusion page types follow these steps 1 2 Create a new or open an existing PHP ASP JSP or ColdFusion page In the Bindings panel click the plus button and select Recordset Query from the menu that appears The simple Recordset dialog box appears If you want to write your own SQL statements click the Advanced button to display the advanced Recordset dialog box In the Name text box enter a name for your recordset You can use only letters numbers and underscores in the name Select a database connection for obtaining the data that you want to display Select a table name for obtaining the data that you want to display After you select a table name the database columns appear in the Columns list For example Figure 1 7 shows the columns for the Employee table see Table 1 1 Recordset Connection photest Define Lx Name Employee Recordset Advanced tekh safeg iejeg pue Jajseyy Guipying 700 Developing Master and Detail Pages Block by Block MBER we a 10 11 Depending on your dynamic page type the Recordset dialog box may appear slightly different from the one in Figure 1 7 ColdFusion in partic ular calls the Connection field a data source and includes the Username and Password fields f
5. properties for the master page in the top half of this dialog box and the properties for the detail page in the lower half 5 From the Recordset drop down list select the recordset that you want to use for the master page For our example we selected Employee Recordset After you select a recordset Dreamweaver fills in the rest of the fields with the columns from the recordset 6 In the Master Page Fields area select which records you want to appear on the master page Click the plus button to add a field and click the minus button to remove a field In Figure 1 2 we selected the irst name and last name fields These fields will appear on the master page in a table format Typically fewer fields appear on the master page than the detail page 7 From the Link to Detail From drop down list select the field in the recordset that you want to serve as the link to the detail page For example we selected the 1ast name field to serve as the link to the detail page for each record 694 Building Master and Detail Pages in One Operation Figure 1 2 The Insert Master Detail Page Set dialog box for the Employee Recordset 8 From the Pass Unique Key drop down list select which field contains the values that you want to pass on to the detail page so it can identify the records Typically you select the key field that ends in ID This key field tells the detail page which record to display for the us
6. steps show you how to fill out the Recordset dialog box the steps are the same for the DataSet dialog box which you fill out when creating an ASP NET detail page Testing Vour Master and Detail Pages Figure 1 14 The browser displays the master page that uses the data from the database After you create a master and detail page set you need to test those pages Follow these steps to preview the pages in a browser 1 Open the master page 2 Choose File gt Preview in Browser Your browser type 3 When Dreamweaver asks you if it s okay to copy the file to the testing site click OK Your browser launches with your master page see Figure 1 14 Mozilla Firefox O x File Edit View Go Bookmarks Tools Help first name last name Jon Phillips Michele Davis Simon Meyer Records 1 to 3 of3 4 Click a hyperlink to view the associated detail page for that record In the employee example the linked field is the employee s last name When you click a link the browser page changes to expand the record and display the detail page as shown in Figure 1 15 Figure 1 15 The browser displays the detail page that uses the testing employee data WING RY Testing Vour Master and Detail Pages Untitled Document Mozilla Firefox n x File Edit View Go Bookmarks Tools Help employee id 2 first name Michele last name Davis address 4425 2nd St ad
7. 92 Building Master and Detail Pages in One Operation Table 1 1 continued zZip 5 Character String pPhone 14 Character String department_id Integer Building Master and Detail Pages in One Operation PHP ASP JSP ColdFusion For PHP ASP JSP and ColdFusion you can build sets of master and detail pages all in one operation You can use the same method for all these languages Creating both the master and detail pages at the same time is generally easier but Dreamweaver gives you the flexibility of creating them separately too For ASP NET you need to build the master and detail pages separately as described in the section Developing Master and Detail Pages for ASP NET later in this chapter You can t build these pages at the same time in one operation for ASP NET To create a master and detail page set for PHP ASP JSP or ColdFusion follow these steps 1 Create a new or open an existing PHP ASP JSP or ColdFusion page blank page opens in Dreamweaver this page becomes your master page in the language that you selected 2 Define a recordset for the page For the lowdown on creating a recordset check out Book VIII Chapter 1 The recordset provides the data that s displayed on both the master and detail pages Make sure that you include all the table columns that you need to create your master page including the unique key the record ID column for each record and all the table
8. MBER Chapter 1 Building Master and Detail Pages In This Chapter Developing master and detail pages at the same time Building your master and detail pages separately Putting together master and detail pages for ASP NET Making sure your master and detail pages work ou can use Dreamweaver to build master and detail Web pages which are a popular way to display information on your Web site A master page displays a list of records and corresponding links for each record A user can click a link to see further information about a record on its associ ated detail page Depending on your programming language you can either build the set of master and detail pages all in one operation or you can separately build the master pages and then the detail pages You can find out more about both methods in this chapter The examples in this chapter use a simple Employee table which you can see in Table 1 1 The first value the employee id is a special field called a key It always has a unique value Therefore if you query for a record in a table by using the key you always get only the row that you re looking for because no two rows have the same key Table 1 1 The Employee Table Column Name Type of Data employee_id Integer first_name 50 Character String last_name 50 Character String aAddress1 75 Character String aAddress2 75 Character String cCity 50 Character String sState 50 Character String continued 6
9. ains the automatically generated objects a repeated region navigation objects record counter and link to the detail page as shown in Figure 1 3 ca etpubiwwwrootUnn etail php XHTML Ei n Modify Text Commands Site Window Hi CEE TELE gs Application 3 Dstabsses Bin ngs Server Behaviors Companies Eznpleyee Recordsetfrst name E ox f Figure 1 3 Bet bee show f This Records Employee Recordset FirssRecord to Employes_Recordset LastRecord of Maye to lest Page Engl D t Employee Recordset TetalRecords rona r Mer Lan rl ec arms ocumen MIA D a window has 1 a repeated ets fox Ste Local tow bad re lon P Test St 21 gion EERIE navigation E Connecnons E id phptest oho objects d desist dase ferm pho record locate Y Properties WE logrz php counter and master dotalphp 1 feurretPage 4 sERUER PHP SELF mester_detel_ucowLtxw m php link to the amp pontos mannous Encloyes Recordset 16 Li Piece z Nu Fnpioyee Pacordest 0 detail page A E Eds E iii KU 1 local items selected totalling 153 13 Modify the design of the master and detail pages You can modify your dynamic fields just like you d edit any other object When you finish designing the pages you re ready to view them in a browser See the section Testing Your Master and Detail Pages later in this chapter for details Develo
10. dress2 city Minneapolis state MN zip 55223 phone 952 233 1232 department_id 1 707 Be sure that both your master page and detail page transfer to the testing server If not when you click a link in the master page you get a Page not found error message Book IX e z 2 3 safieg j1e 9q pue Ja seyy Guipying 708 Book Ix Developing Applications Rapidly
11. e steps 1 Open the master page in the Document window 2 In the table select the placeholder for the dynamic content on which you want to create a link 5 In the Properties inspector click the folder button next to the Link field The Select File dialog box appears see Figure 1 5 Select File 2 x Select file name from File system Sites and Servers Data sources Look jx 3 Unnamed Site 5 gt e ex E3 B master block php E recordset php E login2 php E detail block php E url_case php 18 sample inc php detail php B Unttled 1 php C notes B master detail php pheinfo php C3 i mmServerScripts E process php B restiict php CJ Connections E dynamic_form php E login php File name detail Block php OK Files of ype AliFiles x Cancel URL etai Hock php Relative to Document z master block php Change defaut Link Relative To in the site definition Book IX e z 2 3 safieg I812q pue Jajseyy Guipying 698 Developing Master and Detail Pages Block by Block T Browse to and select the detail page 5 Click the Parameters button to the right of the URL field The Parameters dialog box opens 6 Click the plus button to add a parameter This parameter tells the detail page which row to display Select the key value column as this parameter 7 In the Name column enter the column name For the Employee table Table 1 1
12. er For our example we selected the employee id field 9 Specify the number of records that you want to show at one time on the master page In the example we chose to show 10 records at a time 10 In the Detail Page Name text box enter a name for the detail page or 11 click the Browse button to select an existing file For the example we entered detail php Dreamweaver will automati cally use this name when it creates the detail page In the Detail Page Fields area select which records you want to appear on the master page Click the plus button and minus button to change the fields that appear on the detail page Typically more fields appear on the detail page than the master page For the example we selected all the fields listed in Table 1 1 Figure 1 2 shows the configuration of the Insert Master Detail Page Set dialog box based on the example values Master page Fields all v Link to detail from last_name Insert Master Detail Page Set x Recordset Employee Recordset xl Cancel first name Pass unique key Jemployee id Show 10 Records at a time C Blirecords Detail page name detat pho Browse Detail page fields Ally Developing Master and Detail Pages Block by Block 695 12 Click OK Dreamweaver creates the master and detail pages and includes dynamic content and server behaviors in both The Document window cont
13. he dataset source from the DataSet drop down list and click OK You can leave the default column type as Simple Data Field The DataGrid dialog box for our example looks like Figure 1 10 DataGrid x 1D Ercloyee_DataGrid DataSet RER Cancel Show g gt fio Rei C alirecords Simple data field first name Simple data field last name Simple data Field addresst Simple data field addressz Simple data field city Simple data field zl Developing Master and Detail Pages for ASP NET 703 Figure 1 11 shows the DataGrid object created for the example Book IX ER detal blockpho Unttied 3 safieg 1833 pue 1ajsejy Buipjing DES PEU CV MERE EE REDE GE TERT ZRN UI RR HRS REDE ME TEA Column2 5H abc labe abc abc abc abc abc abc abc abc Figure 1 11 bc Jabe The Document window with the DataGrid object r ET Qi 11009 Creating links that open the detail page After you create the ASP NET master page as described in the preceding section you need to create links that open the detail page and communi cate which record the user selected To open an ASP NET detail page and display the specified record follow these steps 1 Open the master page in the Document window 2 In the Server Behaviors panel double click DataGrid The DataGrid dialog box appears 3 In the Columns list select the column that you want to serve as the link to the detail page
14. he name of the recordset that you want to appear on the master page For the example we selected the EmployeeRecordset 5 Specify the number of records that you want to show at one time on the master page In the example we wanted to show 10 records at a time 6 Optional Specify border cell padding and cell spacing 7 Click OK to close the dialog box The master page is created Figure 1 5 Use the Select File dialog box to configure which page to link to and which parameters to send Developing Master and Detail Pages Block by Block 69 7 If you don t want users to see some of the columns on the master page such as the Record ID column which describes the record to display but is not useful for the end user delete the column from the table by following these steps 1 In Design view click anywhere on the master page 2 Put the pointer near the top of the Record ID column so that the column s entries are outlined in red Then click to select the column 3 Click the Delete button to delete the column from the table Generally fewer records appear on the master page than the detail page Setting up links to open a detail page After you create the master page as the preceding section describes you need to create links that open the detail page and communicate which record the user selected so that only the detail for that record displays To set up links to open a detail page follow thes
15. heck that the detail page brings back the data you expect A table displaying data from the recordset appears Click OK The Test SQL Statement window closes In the Recordset dialog box click OK Figure 1 8 shows the recordset in the Bindings panel of the detail page Developing Master and Detail Pages for ASP NET 701 M es ee Book IX jabases Ings er iomponents Document type rte Chapter 1 Source Enana Format Figure 1 8 CF Engl 2 The CE Employee ae Recordset Se 3 e 2 appears in ef the Bindings S panel z 12 To bind the columns in the recordset to the detail page select the columns in the Bindings panel and drag those columns onto the detail page Your detail page can now process requests from the master page Figure 1 9 shows the Document window after adding fields from the recordset lest db pho Figure 1 9 fi so code jsp rdi onsen cdf E mie united Document giam M e CE X 1 d T E EM E EW H Ig 3 al s The LE 3 i EmployeeRecordses first_name EmployeeRecordsezlas name EmployceRecordset address1 Document _2 EmployeeRecordses cay EmployceRecordset state EmployeeRecordset ap window 3 EmployeeRecordses phone after n dragging several fields from the recordset onto it n i pu nirnluaizuihusiczn Luca ze Re Q new vaxa SKI sec See the section Testing Your Master and Detail Pages later in this chapter to find out how to preview you
16. lick OK to close the Hyperlink Column dialog box Figure 1 13 shows the updated DataGrid dialog box for the example 1D Emeloyee_DataGid Dataset Employes Dataset z faz Show fio Re Help All recoeds Navigation Links to previous and next pages Columns As Type Simple data field Simple data Field address Simple data field address2 Simple data field city Simple data Field xl Edit Change column type 11 Click OK The DataGrid dialog box closes The DataGrid on your page is updated Creating a detail page After you create a master page for ASP NET as described in the two previ ous sections you need to create a detail page to display the record To do Book IX e z 2 3 safeg iejeg pue Jajseyy Guipying 706 Testing Vour Master and Detail Pages so you need to define a dataset for the record and bind its columns to the detail page When creating the detail page you need to know the database column name that you want to reference and the URL parameter that the master page uses to find and display that column s record on the detail page If you don t remember the URL parameter name open the master page go to the Bindings panel and look under the DataSet listing To create an ASP NET detail page create a new ASP NET page in Dreamweaver and follow Steps 2 through 12 in the earlier section Building detail pages Note that although the earlier
17. nter the URL for the link such as Details aspx Data Field Select this radio button if you want to add a link for data displayed in the hyperlink column Then from the drop down list select a data field in your dataset In the example we selected the first name column as shown in Figure 1 12 Format String This field is automatically generated and shows the format of the URL link The URL opens the detail page and uniquely identifies the record to display on the detail page Figure 1 13 The DataGrid dialog box displays the last_name column as a Hyperlink type Developing Master and Detail Pages for ASP NET 705 8 In the Linked Page section click the Browse button next to the Format String box 9 Locate and select which detail page you want to display Note the following when selecting your link page e When you select a detail page Dreamweaver adds information to the URL that specifies a parameter to use to identify the record e Dreamweaver automatically names this parameter based on your database field name but you can change the name to something else if you want to e In any case be sure to note the name of this URL parameter because you need that name when you create the detail page which you can read about in the following section Creating a detail page e Dreamweaver uses a 0 placeholder to indicate where it places the value of the unique identifier when someone accesses the page 10 C
18. or the database However these differences don t change the following steps Select which columns will provide the record data to display To use all columns select All otherwise choose Selected and Ctrl click Windows or 3 click Mac in the list to indicate which columns you want to use Typically your detail page uses more columns than your master page You want the recordset for your detail page to contain at least one column generally the record ID column that matches the column that you use for the master page Complete the Filter sections as follows The first Filter field Select the database column name that contains values to match against the URL parameter You use the filter to find and display the record specified by the URL parameter passed from the master page The second Filter field Select the equals symbol if it s not already selected This requires the fields to be equal which they must be to display only the record that is detailed The third Filter field Select the URL parameter The fourth Filter field Enter the name of the URL parameter that you want the master page to pass to the detail page The recordset now returns only the data for the employee who s been selected on the master page Click the Test button The Test Value dialog box appears Enter a value in the Test Value field and click OK This value represents which detail record displays This test helps you c
19. ping Master and Detail Pages Block by Block You can develop a master page block by block for PHP ASP JSP and ColdFusion While you usually create the master and detail pages at the same time you can create them block by block to have complete control over the placement of the blocks safeg 1e 9q pue sajseyy uping 696 Developing Master and Detail Pages Block by Block MBER RNS amp Figure 1 4 The Dynamic Table dialog box for the Employee Recordset Creating the master page To create a dynamic master page follow these steps 1 Create a page and define a recordset Turn to Book VIII Chapter 1 to find out how to define a recordset The Recordset dialog box varies slightly between dynamic page types Specifically ColdFusion calls the database connection a data source and includes optional Username and Password fields for the database The dialog box also has a button to access ColdFusion components The rest of the dialog box works exactly the same as the dialog box for other development code types In the Document window place the insertion point where you want the records to appear on the page Choose Insert Application Objects Dynamic Data Dynamic Table The Dynamic Table dialog box opens as shown in Figure 1 4 Dynamic Table x c Cancel Show 10 Records at a tme C al records poe Border fi Cell padding Cel spacing 4 From the Recordset drop down list select t
20. r master and detail pages in a browser Developing Master and Detail Pages for ASP NET For ASP NET you can use the DataSet Web control to specify table columns and the DataGrid Web control to list the database records to display on the master page The Web controls provide an easy way to display database data with controls for paging between multiple pages of records 702 Developing Master and Detail Pages for ASP NET NBER ev E MBER we a Figure 1 10 The DataGrid dialog box has the Employee Dataset selected You need to define a database connection for the site before you create the master page See Book VII for details Creating a master page To create an ASP NET master page follow these steps 1 Create a new or open an existing ASP NET page in Dreamweaver 2 In the Bindings panel click the plus button and select DataSet Query from the menu that appears The DataSet dialog box appears 3 Complete the DataSet dialog box and then click OK Make sure to include all table columns that you need to create your master page including the unique key Record ID column for each record A dataset is essentially the same thing as a recordset see Book VIII Chapter 1 for more information on recordsets The new dataset appears in the Binding panel 4 In the Server Behaviors panel click the plus button and select DataGrid from the menu that appears The DataGrid dialog box opens 5 Select t

Download Pdf Manuals

image

Related Search

Related Contents

EC Tremolux_081981a.indd  Danfoss TLX Web Server User Manual L00410494  Bedienungsanleitung Top Light    INSTALLATION MANUAL FOR ILB HELIOS  HP Archive  Registro de los Plaguicidas Químicos de uso Agrícola  La Fête des savoirs  Cours de mode - Alberta Education  Información detallada - Universidad de Valladolid  

Copyright © All rights reserved.
Failed to retrieve file