<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>

<html>
<head id="Head1" runat="server">
    <title>Exemplo com o controle DataList</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ProviderName="System.Data.SqlClient"
            ConnectionString="<%$ ConnectionStrings:nwind%>" SelectCommand="SELECT CategoryID, CategoryName, Description FROM Categories">
        </asp:SqlDataSource>
        <asp:DataList ID="DataList1" runat="server" DataKeyField="CategoryID" DataSourceID="SqlDataSource1">
            <ItemStyle Font-Names="Verdana" Font-Size="X-Small" />
            <ItemTemplate>
                <%# ((DataRowView)Container.DataItem)["CategoryID"]%>
                -
                <%# ((DataRowView)Container.DataItem)["CategoryName"]%>
                <br />
                <%# ((DataRowView)Container.DataItem)["Description"]%>
                <br />
                <asp:LinkButton ID="btnSelect" Text="Selecionar item" CommandName="Select" runat="server" />
            </ItemTemplate>
            <SelectedItemStyle BackColor="Red" />
            <SelectedItemTemplate>
                <%# ((DataRowView)Container.DataItem)["CategoryID"]%>
                -
                <%# ((DataRowView)Container.DataItem)["CategoryName"]%>
                <br />
                <%# ((DataRowView)Container.DataItem)["Description"]%>
            </SelectedItemTemplate>
            <SeparatorTemplate>
                <br />
            </SeparatorTemplate>
        </asp:DataList>
    </div>
    </form>
</body>
</html>
