<%@ Page Title="" Language="C#" MasterPageFile="~/mstr2.Master" AutoEventWireup="true" CodeBehind="AdminManageComments.aspx.cs" Inherits="CarGallery.AdminManageComments" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="server">
    <script type="text/javascript" src=<%# ResolveUrl("http://code.jquery.com/jquery-latest.min.js") %> ></script>
<script type = "text/javascript">

    function checkAll(objRef) {

        var GridView = objRef.parentNode.parentNode.parentNode;

        var inputList = GridView.getElementsByTagName("input");

        for (var i = 0; i < inputList.length; i++) {

            var row = inputList[i].parentNode.parentNode;

            if (inputList[i].type == "checkbox" && objRef != inputList[i]) {

                if (objRef.checked) {
                    inputList[i].checked = true;
                }

                else {
                    inputList[i].checked = false;
                }
            }
        }
    }

</script>

    <div align="right" style="width:100%;max-width:100%;min-width:10%; height:auto;">
        <div align="center" style="color:White;background-color:#507CD1;font-weight:bold; height: 45px;vertical-align:middle;font-size:16px"><br />Manage Comments</div>
        <div align="left" style="height:40px;background-color:white;color:black;margin-top:10px">
            <br />        
            &nbsp; Filter : <asp:DropDownList ID="drdlFilter" runat="server" style="width:auto">
                <asp:ListItem Text="All" Value="0"/>
                <asp:ListItem Text="Confirmed" Value="1"/>
                <asp:ListItem Text="Not Confirmed" Value="2"/>
                                   </asp:DropDownList>

            &nbsp;&nbsp; Post ID : <asp:textBox ID="txtPostID" runat="server" style="width:auto"></asp:textBox>
            &nbsp;&nbsp; <asp:Button ID="btnFilter" runat="server" Text="Filter" OnClick="btnFilter_Click" />

            &nbsp;&nbsp;&nbsp;&nbsp; Page Size : <asp:DropDownList AutoPostBack="true" OnSelectedIndexChanged="drdnPageSize_SelectedIndexChanged" ID="drdnPageSize" runat="server" Width="50px">
                <asp:ListItem Text="5" Value="5"/>
                <asp:ListItem Text="10" Value="10"/>
                <asp:ListItem Text="15" Value="15"/>
                <asp:ListItem Text="20" Value="20"/>
                <asp:ListItem Text="30" Value="30"/>
                <asp:ListItem Text="50" Value="50"/>
                                   </asp:DropDownList>   
        </div>
        
        <div style="width:auto;margin-top:10px;background-color:#507CD1">
            <div style="height:15px"></div>
            <asp:GridView ID="gridView1" style="width:100%;" runat="server" Font-Size="14px" AutoGenerateColumns="False" DataKeyNames="id" OnRowCommand="gridView1_RowCommand" OnRowEditing="gridView1_RowEditing" AllowPaging="True" PageSize="5" OnPageIndexChanging="gridView1_PageIndexChanging" ForeColor="#333333">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:TemplateField HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Top">
                            <HeaderTemplate>
                                <asp:CheckBox ID="checkAll" Text="" runat="server" onclick = "checkAll(this);" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                    <asp:CheckBox ID="chkBatchAction" style="margin-left:8px" onclick = "Check_Click(this)" runat="server"/>
                                    
                            </ItemTemplate>
                            <HeaderStyle Width="30px" />
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="#" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                    <asp:Label ID="lblCounter" runat="server" Text='<%#Bind("no") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle Width="30px"/>
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="name" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                    <asp:Label ID="lblName" runat="server" Text='<%#Bind("name") %>'></asp:Label>
                                    <asp:HiddenField ID="hid" runat="server" Value= '<%#Bind("id") %>' />
                            </ItemTemplate>
                            <HeaderStyle/>
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="email">
                            <ItemTemplate>
                                <center>
                                <asp:Label ID="lblEmail" runat="server" Text='<%#Bind("email") %>'></asp:Label>
                                    </center>
                            </ItemTemplate>
                            <HeaderStyle Font-Bold="False" Font-Size="Small" />
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="description">
                            <ItemTemplate>
                                <center>
                                <asp:Label ID="lblDesc" runat="server" Text='<%#Bind("description") %>'></asp:Label>
                                    </center>
                            </ItemTemplate>
                            <HeaderStyle Font-Bold="False" Font-Size="Small" />
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="Date and Time">
                            <ItemTemplate>
                                <center>
                                <asp:Label ID="lblDateTime" runat="server" Text='<%#Bind("datetime") %>'></asp:Label>
                                    </center>
                            </ItemTemplate>
                            <HeaderStyle Font-Bold="False" Font-Size="Small" />
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="IP">
                            <ItemTemplate>
                                <center>
                                <asp:Label ID="lblIP" runat="server" Text='<%#Bind("ip") %>'></asp:Label>
                                    </center>
                            </ItemTemplate>
                            <HeaderStyle Font-Bold="False" Font-Size="Small" />
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="is confirmed ?">
                            <ItemTemplate>
                                <center>
                                    <asp:ImageButton ID="lbtnConfirm" runat="server" ImageUrl='<%# Bind("confirmed") %>' CommandArgument='<%# Bind("id") %>'  CommandName="Confirm" />

                                </center>
                            </ItemTemplate>
                            <HeaderStyle Font-Bold="False" Font-Size="Small" />
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="Operations" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>

                                        <div align="center" style="width:18px;">
                                            <asp:LinkButton ID="lbtnDelete" runat="server" CommandArgument='<%# Bind("id") %>'  CommandName="Delete"><img src="../img/btn_delete.png" /></asp:LinkButton>
                                            </div>
                                
                            </ItemTemplate>
                        </asp:TemplateField>

                    </Columns>
                    <EditRowStyle BackColor="#2461BF" />
                    <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Height="30px" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="center" Height="25px" Font-Size="18px" />
                    <RowStyle BackColor="#EFF3FB" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                    <SortedDescendingHeaderStyle BackColor="#4870BE" />
                </asp:GridView>
         </div>
        <div style="width:auto;margin-top:10px;background-color:#507CD1">
                        &nbsp;Batch Operation : &nbsp; 
                                <asp:DropDownList ID="drdlBatchAction" runat="server" Width="150px">
                                    <asp:ListItem Text="Confirm Comments" Value="0"/>
                                    <asp:ListItem Text="Unconfirm Comments" Value="1"/>
                                    <asp:ListItem Text="Delete Comments" Value="2"/>
                                </asp:DropDownList>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button id="btnBatchAction" Width="100px" Text="RUN" runat="server" OnClick="btnBatchAction_Click"></asp:Button>
                    </div>
        </div>
</asp:Content>
