<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManageYouTubeItems.aspx.cs" Inherits="Admin_ManageYouTubeItems" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Manage YouTube Items</title>
</head>
<body>
    <form id="form1" runat="server">
        <h1>You Tube Videos Manager</h1>
        <asp:Panel ID="pnlNew" runat="server" >
            <b>Add New</b><br />
            Title:  <asp:TextBox ID="txtTitle" runat="server" Width="150"></asp:TextBox>
            YouTube ID: <asp:TextBox ID="txtYouTubeID" runat="server" Width="100"></asp:TextBox>
            <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" />
        </asp:Panel>
    
        <asp:GridView ID="gvYouTubeLinks" runat="server"
        AlternatingRowStyle-BackColor="#CCCCCC" AlternatingRowStyle-ForeColor="#FFFFFF"
        DataSourceID="dsYouTubeVideos" AutoGenerateDeleteButton="true" AutoGenerateEditButton="true"
        GridLines="Horizontal" DataKeyNames="ID" CellPadding="5" CellSpacing="2" BorderColor="Gray" BorderWidth="1" BorderStyle="Inset"
        Width="80%"/>
        
        <asp:SqlDataSource ID="dsYouTubeVideos" runat="server" 
         SelectCommand="SELECT ID, YouTubeID, Title FROM YouTubeVideos ORDER BY Title" SelectCommandType="Text"
         DeleteCommand="DELETE FROM YouTubeVideos WHERE ID = @ID" DeleteCommandType="Text"
         UpdateCommand="UPDATE YouTubeVideos SET Title = @Title, YouTubeID = @YouTubeID WHERE ID = @ID" UpdateCommandType="Text" />
    </form>
</body>
</html>
