<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="SongFormView.aspx.cs" Inherits="MyTunes.BLLObjectBinding.SongFormView" %>
<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 Binding - Songs in a default FormView (Delete and edit work, so be careful...)" 
            ForeColor="Red" Font-Bold="True"></asp:Label>
    </div>
    <asp:FormView ID="SongsFormView" runat="server" AllowPaging="True" 
        DataKeyNames="song_id" DataSourceID="MyTunesSongsBLL">
        <EditItemTemplate>
            song_id:
            <asp:Label ID="song_idLabel1" runat="server" Text='<%# Eval("song_id") %>' />
            <br />
            artist_id:
            <asp:TextBox ID="artist_idTextBox" runat="server" 
                Text='<%# Bind("artist_id") %>' />
            <br />
            album_id:
            <asp:TextBox ID="album_idTextBox" runat="server" 
                Text='<%# Bind("album_id") %>' />
            <br />
            title:
            <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
            <br />
            url:
            <asp:TextBox ID="urlTextBox" runat="server" Text='<%# Bind("url") %>' />
            <br />
            genre:
            <asp:TextBox ID="genreTextBox" runat="server" Text='<%# Bind("genre") %>' />
            <br />
            track:
            <asp:TextBox ID="trackTextBox" runat="server" Text='<%# Bind("track") %>' />
            <br />
            length:
            <asp:TextBox ID="lengthTextBox" runat="server" Text='<%# Bind("length") %>' />
            <br />
            added:
            <asp:TextBox ID="addedTextBox" runat="server" Text='<%# Bind("added") %>' />
            <br />
            modified:
            <asp:TextBox ID="modifiedTextBox" runat="server" 
                Text='<%# Bind("modified") %>' />
            <br />
            changed:
            <asp:TextBox ID="changedTextBox" runat="server" Text='<%# Bind("changed") %>' />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Update" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </EditItemTemplate>
        <InsertItemTemplate>
            song_id:
            <asp:TextBox ID="song_idTextBox" runat="server" Text='<%# Bind("song_id") %>' />
            <br />
            artist_id:
            <asp:TextBox ID="artist_idTextBox" runat="server" 
                Text='<%# Bind("artist_id") %>' />
            <br />
            album_id:
            <asp:TextBox ID="album_idTextBox" runat="server" 
                Text='<%# Bind("album_id") %>' />
            <br />
            title:
            <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
            <br />
            url:
            <asp:TextBox ID="urlTextBox" runat="server" Text='<%# Bind("url") %>' />
            <br />
            genre:
            <asp:TextBox ID="genreTextBox" runat="server" Text='<%# Bind("genre") %>' />
            <br />
            track:
            <asp:TextBox ID="trackTextBox" runat="server" Text='<%# Bind("track") %>' />
            <br />
            length:
            <asp:TextBox ID="lengthTextBox" runat="server" Text='<%# Bind("length") %>' />
            <br />
            added:
            <asp:TextBox ID="addedTextBox" runat="server" Text='<%# Bind("added") %>' />
            <br />
            modified:
            <asp:TextBox ID="modifiedTextBox" runat="server" 
                Text='<%# Bind("modified") %>' />
            <br />
            changed:
            <asp:TextBox ID="changedTextBox" runat="server" Text='<%# Bind("changed") %>' />
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insert" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </InsertItemTemplate>
        <ItemTemplate>
            song_id:
            <asp:Label ID="song_idLabel" runat="server" Text='<%# Eval("song_id") %>' />
            <br />
            artist_id:
            <asp:Label ID="artist_idLabel" runat="server" Text='<%# Bind("artist_id") %>' />
            <br />
            album_id:
            <asp:Label ID="album_idLabel" runat="server" Text='<%# Bind("album_id") %>' />
            <br />
            title:
            <asp:Label ID="titleLabel" runat="server" Text='<%# Bind("title") %>' />
            <br />
            url:
            <asp:Label ID="urlLabel" runat="server" Text='<%# Bind("url") %>' />
            <br />
            genre:
            <asp:Label ID="genreLabel" runat="server" Text='<%# Bind("genre") %>' />
            <br />
            track:
            <asp:Label ID="trackLabel" runat="server" Text='<%# Bind("track") %>' />
            <br />
            length:
            <asp:Label ID="lengthLabel" runat="server" Text='<%# Bind("length") %>' />
            <br />
            added:
            <asp:Label ID="addedLabel" runat="server" Text='<%# Bind("added") %>' />
            <br />
            modified:
            <asp:Label ID="modifiedLabel" runat="server" Text='<%# Bind("modified") %>' />
            <br />
            changed:
            <asp:Label ID="changedLabel" runat="server" Text='<%# Bind("changed") %>' />
            <br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Edit" />
            &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                CommandName="Delete" Text="Delete" />
            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="New" />
        </ItemTemplate>
        <PagerSettings Mode="NumericFirstLast" PageButtonCount="25" />
    </asp:FormView>
    <asp:ObjectDataSource ID="MyTunesSongsBLL" runat="server" 
        DeleteMethod="DeleteSong" InsertMethod="AddSong" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetSongs" 
        TypeName="MyTunes.Common.BLL.SongBLL" UpdateMethod="UpdateSong">
        <DeleteParameters>
            <asp:Parameter Name="songID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="artistID" Type="Int32" />
            <asp:Parameter Name="albumID" Type="Int32" />
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="genre" Type="String" />
            <asp:Parameter Name="length" Type="String" />
            <asp:Parameter Name="track" Type="String" />
            <asp:Parameter Name="url" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="songID" Type="Int32" />
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="genre" Type="String" />
            <asp:Parameter Name="length" Type="String" />
            <asp:Parameter Name="track" Type="String" />
            <asp:Parameter Name="url" Type="String" />
        </UpdateParameters>
    </asp:ObjectDataSource>
</asp:Content>
