<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="AlbumsDetailView.aspx.cs" Inherits="MyTunes.BLLObjectBinding.AlbumsDetailView" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <asp:Label ID="lblDebug" runat="server" 
            Text="Object/Business Logic Layer - Albums by Artist in a DetailView" Font-Bold="True" 
            ForeColor="Red"></asp:Label>
    </div>
    <div>
        <asp:Label ID="Label1" runat="server" Text="Select Artist"></asp:Label>
        <asp:DropDownList ID="listArtists" runat="server" AutoPostBack="True" 
            DataSourceID="MyArtists" DataTextField="artist" DataValueField="artist_id">
        </asp:DropDownList>
        <asp:ObjectDataSource ID="MyArtists" runat="server" DeleteMethod="DeleteArtist" 
            InsertMethod="AddArtist" OldValuesParameterFormatString="original_{0}" 
            SelectMethod="GetArtists" TypeName="MyTunes.Common.BLL.ArtistBLL" 
            UpdateMethod="UpdateArtist">
            <DeleteParameters>
                <asp:Parameter Name="artistID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="artistName" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="artistID" Type="Int32" />
                <asp:Parameter Name="artistName" Type="String" />
            </UpdateParameters>
        </asp:ObjectDataSource>
    </div>
    <div>
        <asp:DetailsView ID="AlbumDetailsView" runat="server" Height="50px" 
            Width="125px" AllowPaging="True" AutoGenerateRows="False" 
            DataKeyNames="album_id" DataSourceID="MyArtistAlbums">
            <Fields>
                <asp:BoundField DataField="album_id" HeaderText="album_id" ReadOnly="True" 
                    SortExpression="album_id" />
                <asp:BoundField DataField="artist_id" HeaderText="artist_id" 
                    SortExpression="artist_id" />
                <asp:BoundField DataField="album" HeaderText="album" SortExpression="album" />
            </Fields>
        </asp:DetailsView>
        <asp:ObjectDataSource ID="MyArtistAlbums" runat="server" 
            DeleteMethod="DeleteAlbum" InsertMethod="AddAlbum" 
            OldValuesParameterFormatString="original_{0}" 
            SelectMethod="GetAlbumsByArtistID" TypeName="MyTunes.Common.BLL.AlbumBLL" 
            UpdateMethod="UpdateAlbum">
            <DeleteParameters>
                <asp:Parameter Name="albumID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="artistID" Type="Int32" />
                <asp:Parameter Name="albumName" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="listArtists" DefaultValue="1" Name="artistID" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="albumID" Type="Int32" />
                <asp:Parameter Name="albumName" Type="String" />
            </UpdateParameters>
        </asp:ObjectDataSource>
    </div>
</asp:Content>
