<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Songs.aspx.cs" Inherits="MyTunes.DatabaseBinding.Songs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:DataList ID="DataList1" runat="server">
    </asp:DataList><asp:GridView ID="SongGridView" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="song_id" 
        DataSourceID="MyTuesSqlDataSource" onrowcommand="SongGridView_RowCommand" 
        PageSize="25">
        <Columns>
            <asp:BoundField DataField="song_id" HeaderText="song_id" ReadOnly="True" 
                SortExpression="song_id" Visible="False" />
            <asp:TemplateField HeaderText="artist_id" SortExpression="artist_id">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("artist_id") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" 
                        CommandArgument='<%# Bind("artist_id") %>' CommandName="Artist" 
                        Text='<%# LookupArtistName(Eval("artist_id")) %>'></asp:LinkButton>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("artist_id") %>' 
                        Visible="False"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="album_id" SortExpression="album_id">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("album_id") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("album_id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="title" HeaderText="title" SortExpression="title" />
            <asp:BoundField DataField="genre" HeaderText="genre" SortExpression="genre" />
            <asp:BoundField DataField="track" HeaderText="track" SortExpression="track" />
            <asp:BoundField DataField="length" HeaderText="length" 
                SortExpression="length" />
            <asp:BoundField DataField="added" HeaderText="added" SortExpression="added" />
            <asp:BoundField DataField="modified" HeaderText="modified" 
                SortExpression="modified" />
        </Columns>
        <PagerSettings Mode="NextPreviousFirstLast" PageButtonCount="25" 
            Position="TopAndBottom" />
    </asp:GridView>
    <asp:SqlDataSource ID="MyTuesSqlDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:MyTunesConnectionString %>" 
        SelectCommand="SELECT [song_id], [artist_id], [album_id], [title], [genre], [track], [length], [added], [modified] FROM [song]">
    </asp:SqlDataSource>
</asp:Content>
