When you ve finished (Web server hosting) defining the query, click OK
When you ve finished defining the query, click OK in the Query Builder. Then click Next and Finish to return to the page. The only thing you d really need to format in the GridView control would be the ItemPrice field, which will show in that 29.9500 format if you don t set its Format to Currency. To format the ItemPrice column, choose Edit Columns from the GridView s Common Tasks menu. Choose Subtotal from the Selected Fields box near the bottom of the dialog box. Then set that field s DataFormatString property to {0:C} as shown in the examples presented earlier in this chapter. While you re at it, click the + sign next to ItemStyle in the Properties list, then set the HorizontalAlign property to Right to have number right-align within the column. Then click OK. In Design view, the page won t look like much, just the usual placeholders. Figure 12-67 shows an example. The Sales by Customer text at the top of the page is just text I typed right into the page. The GridView is bound to the query shown back in Figure 12-64, which subtotals by user. The FormView control is the same as described at the start of this section. When viewed in a Web browser, though, the page shows total sales by user, with a grand total at the bottom, as shown in Figure 12-68. You could create three separate pages, one for each type of query, making it easy to view subtotals and totals by user, product, or month. It s important to understand that all of the examples you ve seen in this chapter are just examples. There s almost no limit to the things you can do with the GridView, DetailsView, DataList, and FormView data controls in Visual Web Developer. In this chapter, we ve barely scratched the tip of the proverbial surface. But this should be enough to get you in the ball game, and to see how you can easily bind data controls to SQL server tables and views to extract whatever data you need to show on a Web page. Figure 12-66: Group By and Sum to subtotal by Month. Chapter 12: Using Data in Web Pages 317
We recommend high quality webhost to host and run your jsp application: christian web host services.