<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ToDoList.aspx.cs" Inherits="ToDoList" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <atlas:ScriptManager EnablePartialRendering="true" runat="server" ID="sm1"></atlas:ScriptManager>


   <div id="category">
      Status : 
      <asp:DropDownList ID="drpStatus" runat="server" AutoPostBack="True">
         <asp:ListItem Value="false">Active</asp:ListItem>
         <asp:ListItem Value="true">Completed</asp:ListItem>
      </asp:DropDownList>
      

   </div>
   <div id="todoheader">
      <h2>Zadania do wykonania</h2>
      
      <atlas:UpdatePanel ID="up1" runat="server">
         <ContentTemplate>
            <asp:GridView ID="grdList" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="TaskId" DataSourceID="odsTasks">
               <Columns>
                  <asp:CommandField ShowEditButton="True" />
                  <asp:BoundField DataField="Name" HeaderText="Nazwa" SortExpression="Name" />
                  <asp:CheckBoxField DataField="Complete" HeaderText="Ukończono" SortExpression="Complete" />
               </Columns>
            </asp:GridView>
         </ContentTemplate>
         <Triggers>
            <atlas:ControlValueTrigger ControlID="drpStatus" PropertyName="SelectedValue" />
         </Triggers>
      </atlas:UpdatePanel>

      
      <div id="insertheader">
         <span>Dodaj nowe zadanie</span>
      </div>
      <atlas:UpdatePanel ID="upDetails" runat="server" Mode="Conditional">
        <ContentTemplate>
          <asp:DetailsView ID="dvTask" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" DataKeyNames="TaskId" DataSourceID="odsTasks" DefaultMode="Insert">
            <Fields>
               <asp:BoundField DataField="TaskId" HeaderText="Id zadania" InsertVisible="False" ReadOnly="True"
                  SortExpression="TaskId" />
               <asp:BoundField DataField="Name" HeaderText="Nazwa" SortExpression="Name" />
               <asp:CheckBoxField DataField="Complete" HeaderText="Ukończono" SortExpression="Complete" />
               <asp:CommandField ShowInsertButton="True" />
            </Fields>
         </asp:DetailsView>
        </ContentTemplate>
      </atlas:UpdatePanel>

      
      
      <asp:ObjectDataSource ID="odsTasks" runat="server" DeleteMethod="Delete" InsertMethod="Insert"
         OldValuesParameterFormatString="original_{0}" SelectMethod="GetCompletedTasks"
         TypeName="TasksTableAdapters.TasksTableAdapter" UpdateMethod="Update">
         <DeleteParameters>
            <asp:Parameter Name="Original_TaskId" Type="Int32" />
         </DeleteParameters>
         <UpdateParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="Complete" Type="Boolean" />
            <asp:Parameter Name="Original_TaskId" Type="Int32" />
         </UpdateParameters>
         <SelectParameters>
            <asp:ControlParameter ControlID="drpStatus" Name="IsComplete" PropertyName="SelectedValue"
               Type="Boolean" />
         </SelectParameters>
         <InsertParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="Complete" Type="Boolean" />
         </InsertParameters>
      </asp:ObjectDataSource>
   </div>
</asp:Content>

