Adding picture captions Let s suppose that you also (Hosting your own web site)

Adding picture captions Let s suppose that you also want to show each picture s caption. But as an added bonus, you want to make each caption a link that, when clicked, shows the corresponding image at full size, rather than with the Width you set for the Image control. The trick here is to add a HyperLink control to the template. Set the Text of that link to the PictureCaption field, and the NavigateURL property to the PictureURL field. Here are the steps: 1. In Design view, choose Edit Templates from the DataList control s Common Tasks menu. 2. In the ItemTemplate, click to the right of the Image control and press Enter to make a little room under the control. 3. From the Standard group of tools in the Toolbox, drag a HyperLink control into the ItemTemplate, so that it s under the Image control. 4. From the HyperLink control s Common Tasks menu, choose Edit DataBindings. 5. Set the Text property to the name of the field that contains the text to show. In my example, that would be the PhotoCaption field, as shown in Figure 12-54. 6. In the left column, click on NavigateURL to define where the link will take the user. 7. Set the Bound To property for the NavigateURL property to the name of the control that contains the path to a page or picture. In this example, that would be the PhotoURL field, as shown in Figure 12-55. Figure 12-54: The Text property for the sample Hyper Link control. Chapter 12: Using Data in Web Pages 307
We recommend high quality webhost to host and run your jsp application: christian web host services.

Leave a Reply