JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Creating a Data List

In the In Depth section of this chapter, we created the WebDataList example, which is on the CD-ROM, and used a data list to display data from the authors table in the pubs database. In that example, we created an Item Template to display the authors' first and last names, using label controls. Here's what the actual HTML looks like for the data list in this example:

<asp:DataList id=DataList1 style="Z-INDEX: 101; LEFT: 95px; POSITION:
absolute; TOP: 69px" runat="server" DataSource=
'<%# DataBinder.Eval(DataSet11,
"Tables[authors]") %>' BorderStyle="Solid">
<ItemTemplate>
&nbsp;
<asp:Label id=Label1 runat="server" Text=
'<%# DataBinder.Eval(Container, "DataItem.au_fname") %>'>
</asp:Label>&nbsp;
<asp:Label id=Label2 runat="server" Text=
'<%# DataBinder.Eval(Container,
"DataItem.au_lname") %>'></asp:Label>
</ItemTemplate>
</asp:DataList>

You can see the results in Figure 23.7; for more details on this example, see the In Depth section of this chapter.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor