<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Playlists.aspx.cs" Inherits="MyTunes.Library.Playlists" %>
<%@ Register src="SearchPagerControl.ascx" tagname="SearchPagerControl" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
    <uc1:SearchPagerControl ID="PlaylistSearchPager" runat="server" />
    <div>
                <asp:HyperLink ID="lnkNewPlaylist" runat="server" 
                    NavigateUrl="~/Library/CreatePlaylist.aspx" 
                    ToolTip="Create a new empty playlist">New...</asp:HyperLink>
    </div>
    <asp:GridView ID="PlaylistGridView" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" 
    DataSourceID="PlaylistDataSource" style="text-align: center">
        <Columns>
            <asp:BoundField DataField="PlaylistID" HeaderText="PlaylistID" ReadOnly="True" 
                SortExpression="PlaylistID" Visible="False" />
            <asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" 
                SortExpression="Name" />
            <asp:TemplateField HeaderText="# of Songs">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" 
                        Text='<%# GetSongCount(Eval("PlaylistID")) %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Actions">
                <ItemTemplate>
                    <asp:HyperLink ID="lnkPlay" runat="server" 
                        NavigateUrl='<%# GetPlayLink(Eval("PlaylistID")) %>'>Play...</asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:LinqDataSource ID="PlaylistDataSource" runat="server" 
    ContextTypeName="MyTunes.Library.MyTunesDataContext" EntityTypeName="" 
    OrderBy="Name" Select="new (PlaylistID, UserName, Name)" TableName="Playlists">
</asp:LinqDataSource>
    </asp:Content>
