Archive for October, 2007

In the Properties dialog box that opens, click (Web proxy server)

Saturday, October 13th, 2007

In the Properties dialog box that opens, click on General in the left pane. Then specify the number of columns you want to display from the Columns option. For the Layout option, you need to choose Table. If you choose Flow, the columns won t work. Use the Flow option only when you want data displayed without a table. Use the Direction option to choose a Horizontal or Vertical orientation for the columns. If you choose Horizontal, the first record s data appears first, the second record s data appears in the column to the right, and so forth. If you choose Vertical, the first record s data appears first, the second record s data appears under that one in the same column, then the third record, and so forth down the page. To put some space between columns, click the Borders option at the left side of the Properties dialog box. Then set the Cell Spacing setting to the number of pixels to put between each column. Optionally, if you want to show border lines on the page, choose an option from the Grid Lines drop-down list. Then choose a color and width for the borders. To see the results of your changes, click OK to close the Properties dialog box. Then view the page in a Web browser. Figure 12-47 shows an example where I set Columns to 2, Direction to Horizontal, and Cell Spacing to 40. It s the same data as in Figure 12-46 split into two columns. Using DataList to show pictures In Chapter 11, I created a sample table named Photos that contains two text fields named PhotoCaption and PhotoURL. The PhotoCaption field contains Figure 12-47: The DataList control showing data in two columns. 302 Part III: Personalization and Databases
In case you need quality webspace to host and run your web applications, try our personal web hosting services.

Showing a DataList in columns The DataList control (Anonymous web server)

Friday, October 12th, 2007

Showing a DataList in columns The DataList control can also show data in newspaper-style columns. To use this feature, you ll need to end Template Editing if you re still viewing the Item Template in the Design surface. Right-click the DataList control and choose End Template Editing, or choose End Template Editing from the DataList control s Common Tasks menu. Then, click the tiny triangle near the upper-right corner of the DataList control (not a single Label control) and choose Property Builder. Figure 12-46: The DataList control from Figure 12-43 in a Web browser. Figure 12-45: The Data Bindings dialog box for the ItemPrice Label control. Chapter 12: Using Data in Web Pages 301
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

I also boldfaced the ItemNameLabel control and italicized (Web design seattle)

Thursday, October 11th, 2007

I also boldfaced the ItemNameLabel control and italicized the ItemPriceLabel control, just to illustrate the idea. I ll show you how that DataList control looks in a Web browser in a moment. First, let s talk about . . . Formatting dates and numbers in a DataList To apply a date or currency format to a field, click its Label control to select the control. Then, click its tiny triangle button to show its Common Tasks menu as shown in Figure 12-44. Then, choose Edit DataBindings. A DataBindings dialog box for the selected control opens. If the item you re formatting is a currency or date value, use the Format drop-down list to choose a format for the item. For example, Figure 12-45 shows the DataBindings dialog box for the ItemPrice control in my sample DataList. You can see where I ve chosen Currency {0:C} from the Format drop-down list to display that value in Currency format. Figure 12-46 shows the results in a Web browser. The arrangement and appearance of data on the page is a direct reflection of the arrangement of the Label controls shown back in Figure 12-43. Each ItemPrice is shown in Currency format ($29.95) rather than the default 29.9500 format. Figure 12-44: Common Tasks for a single bound Label control. Figure 12-43: DataList control s Item Template radically rearranged. 300 Part III: Personalization and Databases
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

that text however you like. For example, you (Web hosting comparison)

Wednesday, October 10th, 2007

that text however you like. For example, you can select a chunk of text and use options on the Formatting toolbar to make it bold, change its font, or whatever. Items enclosed in square brackets are Label controls that are bound to data in the underlying database table or view. Those you can format in a similar manner. But you don t drag the mouse pointer through the item as you would with regular text. You just click the item to select it. Then choose options from the Formatting toolbar. To select multiple Label controls, click one to select it. Then hold down the Ctrl key while clicking others that you want to select. You can also rearrange things in the ItemTemplate to change how things look on the page. Moving things around can be a little awkward, especially if you re trying to align controls side-by-side. That s because the items wordwrap within the template, just as they would in a word processing program. To get things side-by-side, you may need to widen the control. To do so, click the top of the DataList control to select it. Then use the sizing handle on its right border to widen or narrow the control. To move an item, just drag it to where you want to put it. Or, click the item to select it, press Ctrl+X to cut it, click where you want to put the control, and press Ctrl+V to paste it. If you want a space to appear between items in the page, make sure to insert a blank space between the items within the template. Figure 12-43 shows an example where I deleted all the text labels, leaving only the bound Label controls. Those I rearranged so that the ItemNameLabel is on the top. The ItemDescriptionLabel, OurItemIdLabel, and ItemPriceLabel controls are side-by-side on one line, with one space between them. Chapter 12: Using Data in Web Pages 299 Blank lines in a DataList control Though you can t see them, any extra carriage returns at the bottom of the control will add height to the control, and will also put extra space between each record on the Web page. (A carriage return is an invisible character that gets added every time you press the Enter or Return key.) To reduce the height of a DataList control, you may need to remove some of those extra carriage returns. You ll need to be in the Edit Templates mode, like Figure 12-42, to do that. Click inside the template, then move the cursor to the bottom of the template (press Ctrl+End). From there, each time you press Backspace you ll remove one carriage return (one blank line). If you go too far and delete a control within the template, press Undo (Ctrl+Z) to undo the deletion.
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

Formatting a DataList control (Web hosting provider) The real beauty of

Tuesday, October 9th, 2007

Formatting a DataList control The real beauty of the DataList control comes into play when you edit its template. To do so, click the DataList control to select it, then click the tiny triangle button near its upper-right corner. Or right-click the DataList control and choose Show Smart Tag. From the Common Tasks menu that appears, choose Edit Templates. The control takes on a completely different look, as shown in Figure 12-42. The Item Template is like a small page that you can edit using standard word processing techniques and HTML. Text that s not enclosed in square brackets is just plain text typed right into the control. You can edit, format, or delete Figure 12-42: A DataList control Item Template. Figure 12-41: Fields from Figure 12-40 as displayed by a DataList control. 298 Part III: Personalization and Databases
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

Affordable web hosting - 3. Drag a DataList control from the Toolbox

Monday, October 8th, 2007

3. Drag a DataList control from the Toolbox onto the page (or Content Placeholder on a page that has a Master Page). 4. From the DataList control s Common Tasks menu, select Choose Data Source.. 5. As usual, choose Database and click OK. 6. Choose your usual connection string, and click Next. That gets you to the standard Configure the Select Statement page. 7. In the Configure the Select Statement page, choose the table or view from which the control will retrieve data. As always, you can use the WHERE button to limit the records shown. Use the ORDER BY button to specify a sort order. Figure 12-40 shows an example where I ve opted to show all fields except ItemID from the Items table. I also used the ORDER BY button to set the sort order to OurItemID, Ascending order (though the only place you can see that is in the ORDER BY clause at the end of the SELECT statement). 8. Click Next and Finish to return to the page. In Design view, the bound DataList control appears as a placeholder of field names with abc placeholders for text, and random values like 0 and 0.1 as placeholders for numbers. When you view the page in a Web browser, you get a better idea of how the data will look to a person viewing the page through a Web browser. Figure 12-41 shows how the fields from the Items table look when viewed through an unmodified DataList control. Figure 12-40: Sample field selections for a DataList control. Chapter 12: Using Data in Web Pages 297
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.

FormView controls described later in this chapter. Both (1 on 1 web hosting)

Sunday, October 7th, 2007

FormView controls described later in this chapter. Both GridView and Details View have an Auto Format option on their Common Tasks menu, making it easy to define a general look and feel for the control right off the bat. Both GridView and DetailsView also have an enormous number of properties you can tweak to get exactly the look and feel you want. There are so many properties that it would take more pages than there are in this book to describe them all. But rather than worry about every single property, a good general strategy might be to use Auto Format to get a general look for the control. Then use Properties to refine details, but only if you want to change something about the format. Beyond all the properties for the control as a whole, there are many properties for each column in a GridView, and each field in a DetailsView. To get to those properties, you have to choose Edit Columns or Edit Fields from the control s Common Tasks menu. Then, under Selected Fields in the dialog box that opens, click on a specific field name under Selected Fields. The properties for that one column or field appear in a Properties sheet within the dialog box. Remember that you can use both GridView and DetailsView either to show data or to allow editing of data in the database. But if you want to use either control to edit data, you must bind the control to a single table that has a primary key. Also, when using the DetailsView control to edit data, you need to remember to click the Advanced button in the Configure Select Statement page, as described under Binding a DetailsView control earlier in this chapter. The DataList and FormView controls described later in this chapter are older ASP.NET controls. Although they hint at offering data-editing capabilities, they are much harder to use for that purpose. Your best bet is to try to use GridView or DetailsView when you know, in advance, that you want to edit data in the underlying database. Use DataList and FormView when you re just concerned with showing data on a page, without letting users make changes to that data. Using the DataList Control The DataList control is ideal for when you want to show data to users as though it were normal text, as opposed to items in a table or on a form. The DataList control s biggest strength is that it allows you to list data in just about any format imaginable. Using the DataList control is much like using the other Data controls you ve seen in this chapter. Just follow these steps: 1. Create or open an .aspx page so you re in Design view. 2. In the Toolbox, expand the Data category of controls. 296 Part III: Personalization and Databases
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

On the Common Tasks menu for the (Web server certificate) DetailsView

Saturday, October 6th, 2007

On the Common Tasks menu for the DetailsView control, choose Enable Edit and Enable Delete to display the Edit and Delete options that allow the user to edit the transaction. When you first open a page like the Master-Details example, the DetailsView control will not be visible in the Web browser. That s because it s filtered to show only the transaction associated with the row that s selected in the GridView. So when there s nothing selected in the GridView, there s nothing for the DetailsView control to show. But as soon as you click Select at the left side of the GridView, your DetailsView control will appear showing the selected transaction record. As an alternative to showing nothing when the DetailsView control has no record, you can edit its EmptyData Template to show a message. Here s how: 1. In Design view, open the DetailsView control s Common Tasks menu using the little triangle button or by right-clicking the control and choosing Show Smart Tag. 2. On the menu, click Edit Templates. 3. In the drop-down list that appears, choose EmptyData Template. A small box appears in which you can type and format text. For example, you might type Select a transaction to see details. 4. Right-click the template you just filled and choose End Template Editing. From now on, when you first open the page in a Web browser, you ll see whatever text you typed into the EmptyData Template rather than nothing. As soon as you select a transaction from the GridView control, that text will be replaced by the actual DetailsView control showing the selected transaction. General GridView and DetailsView considerations The GridView and DetailsView controls are both new in ASP.NET 2.0, and offer easier, better editing capabilities than the older DetailsView and Figure 12-39: The WHERE condition for the Details View1 control. Chapter 12: Using Data in Web Pages 295
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Free web hosting music - After finishing the Data Configuration Wizard for the

Saturday, October 6th, 2007

After finishing the Data Configuration Wizard for the GridView control, you need to choose Enable Select from its Common Tasks menu. Doing so places the Select option to the left of each record. As you ll see in a moment, the DetailsView control can then be configured to show only the record that s represented by the selected row in the GridView control. The Master-Details DetailsView control The DetailsView control in the Master-Details example needs to be filtered so that it displays only the transaction associated with whatever row is selected in the GridView. Also, that control needs to be bound to a single table that has a primary key. Otherwise, you couldn t use the control to edit or delete records. In this example, the Configure the Select Statement page for the DetailsView control looks like Figure 12-38. Note that it s bound to the Transactions table, and shows all fields from that table (the * is short for all columns ). To ensure that the DetailsView control shows only data associated with the record that s selected in the GridView control, click the WHERE button and choose options as shown in Figure 12-39. Those options, in English, say where the TransactionId in the Transactions table matches the TransactionId in whatever row is currently selected in the GridView. Figure 12-38: Table and columns bound to the Details View control. Figure 12-37: The WHERE condition for Master- Details GridView control. 294 Part III: Personalization and Databases
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

Web host forum - To customize the appearance of the DropDownList control,

Friday, October 5th, 2007

To customize the appearance of the DropDownList control, first click the control to select it. Then use its Properties sheet to refine the control s font and width. Master-Details GridView control The GridView control, named GridView1 in the Master-Details example, is bound to the DetailedUsersItemsView view created back in Chapter 11. It uses a few fields from that view to make it easy for the user to locate a specific transaction, as shown in Figure 12-36. The critical factor in getting the GridView control to show only records for the user whose name appears in the DropDownList control is in the WHERE clause. After clicking the WHERE button in Figure 12-36, I set up the condition as shown in Figure 12-37. Recall that the value of the DropDownList1 control will be one person s UserId. Therefore, the condition specified in Figure 12-37 is for the GridView to show only records where the UserId field in the view matches the UserId that s in the DropDownList1 control. Figure 12-36: Selected view and columns used for the Master- Details GridView 1 control. Figure 12-35: Data source for the DropDown List control in Master- Details. Chapter 12: Using Data in Web Pages 293
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.