<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManageWritings.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>Writings Manager</h1>
        <asp:Panel ID="pnlNew" runat="server" >
            <b>Add New</b><br />
            Title:  <asp:TextBox ID="txtTitle" runat="server" Width="150"></asp:TextBox><br />
            Body: <asp:TextBox ID="txtBody" runat="server" Width="200" TextMode="MultiLine"></asp:TextBox><br />
            Is Featured: <asp:CheckBox ID="chkIsFeatured" runat="server" />
            <asp:FileUpload ID="fileThumbnail" runat="server" />
            <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, Title, Thumbnail, Body, IsFeatured FROM WRITINGS ORDER BY AddedDate" SelectCommandType="Text"
         DeleteCommand="DELETE FROM Writings WHERE ID = @ID" DeleteCommandType="Text"
         UpdateCommand="UPDATE Writings SET Title = @Title, Thumbnail = @Thumbnail, Body = @Body, IsFeatured = @IsFeatured  WHERE ID = @ID" UpdateCommandType="Text" />
    </form>
</body>
</html>
