<%@ page language="C#" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage_new.master" autoeventwireup="true" inherits="Pages_Components_Biometric_BiometricStudentAttendance, App_Web_fo2mhtxy" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl" TagPrefix="ScreenGroup" %>
<%@ Register Src="~/UserControls/DatePicker/DatePickerControl.ascx" TagName="DatePickerControl" TagPrefix="Date" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <asp:UpdatePanel ID="IncidentLogUpdatePanel" runat="server" UpdateMode="Always">
        <ContentTemplate>
            
            <div id="divContentPage" class="divcontentpagemargin">

                <div class="dashBoardLeftCont" valign="top">
                    <div class="himssuHeader3WireBox">
                        <table width="0px" cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <div class="himsBoxContent">
                                        <div class="leftUlMenu">
                                            <ScreenGroup:ScreenGroupControl EnableViewState="true" ID="ScreenGroupControl" ScreenGroupId="166"
                                                Visible="true" runat="server" />
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="row whiteboxpaddingleft">
                    <div class="himssuHeader2WireBox">
                        <div class="contentHolder" style="padding-top: 0px; padding-left: 0px; padding-right: 0px">
                            <div class="himssuHeader1WireBox card card-box">
                                <div class="himsBoxHeader card-head">
                                    <div class="leftdiv">
                                    </div>
                                    <div class="himsBoxTitle">
                                        <div class="headerText">
                                            <header>
                                                <i class="fas fa-registered"></i>
                                                <asp:Label ID="BiometricEmployeeAttendanceLabel" runat="server" Text="Biometric Student Attendance"></asp:Label>
                                            </header>
                                        </div>
                                    </div>
                                    <div class="fRight mt-27 pagination display-flex">
                                        <asp:Button ID="BackButton" runat="Server" SkinID="0" CssClass="btn btn-back fas" Text="&#xf30a;  back" OnClick="BackButton_Click" Visible="false" />
                                    </div>
                                </div>
                                <div class="himsBoxContent card-body">
                                    <asp:Panel ID="DetailPanel" runat="Server">
                                        <div class="contentHolder">
                                            <div class="cBoth">
                                            </div>
                                            <asp:Panel ID="SearchCriteriaPanel" runat="Server">
                                                
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="AttendanceDateLabel" runat="server" Text="Attendance Date" SkinID="MandatoryLabel"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <Date:DatePickerControl DisplayDatePicker="true" ID="AttendanceDatePickerControl" runat="server" />
                                                    </div>
                                                </div>
                                               <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="ClassLabel" runat="server" Text="Class" SkinID="MandatoryLabel"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:DropDownList ID="SearchClassDropDownList" runat="server" CssClass="form-control" SkinID="CustomWidthDropDownList"
                                                            onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"  AutoPostBack="true"
                                                            OnSelectedIndexChanged="SearchClassDropDownList_OnSelectedIndexChanged"/>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="DivisionLabel" runat="server" Text="Division" SkinID="MandatoryLabel"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:DropDownList ID="SearchDivisionDropDownList" runat="server" CssClass="form-control" SkinID="CustomWidthDropDownList"
                                                            onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()" />
                                                    </div>
                                                </div>
                                                 <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="AttendanceTypeLabel" runat="server" Text="Attendance Type" SkinID="MandatoryLabel"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:DropDownList ID="AttendanceTypeDropDownList" runat="server" CssClass="form-control" SkinID="CustomWidthDropDownList"
                                                            onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()" />
                                                    </div>
                                                </div>
                                                

                                                <div class="cBoth">
                                                </div>
                                                 <div class="outerBox pTop5 col-md-3">
                                            <div class="controlLabelWidth">
                                                <asp:Label ID="StatusLabel" runat="server" Text="TimeSheet Status" SkinID="0"></asp:Label>
                                            </div>
                                            <div class="fLeft pRight5">
                                                <asp:DropDownList ID="StatusDropDownList" runat="server" CssClass="form-control" AutoPostBack="false">
                                                    <asp:ListItem Text="- ALL -" Value="0"></asp:ListItem>
                                                    <asp:ListItem Text="Present" Value="P"></asp:ListItem>
                                                    <asp:ListItem Text="Absent" Value="A"></asp:ListItem>
                                                    <asp:ListItem Text="Half Day" Value="HD"></asp:ListItem>
                                                    <asp:ListItem Text="Error Case" Value="E"></asp:ListItem>
                                                    <asp:ListItem Text="Holiday" Value="H"></asp:ListItem>
                                                    <asp:ListItem Text="Not Applicable" Value="XX"></asp:ListItem>
                                                    <asp:ListItem Text="Less Hours" Value="LH"></asp:ListItem>
                                                    <asp:ListItem Text="Present On WeekOff Holiday" Value="PH"></asp:ListItem>
                                                    <asp:ListItem Text="Week Offs" Value="W"></asp:ListItem>
                                                </asp:DropDownList>
                                            </div>
                                        </div> <div class="cBoth">
                                                </div>
                                                <div class="alignCenter pTop5">
                                                    <asp:Button ID="ApplyButton" Text="Apply" runat="Server" OnClick="ApplyButton_Click" SkinID="0" CssClass="btn-apply btn fas" />
                                                    <asp:Button ID="ExportButton" runat="server" CssClass="btn-examcommon btn fas" SkinID="0" Text="&#xf093; Export" OnClick="ExportButton_Click" />
                                                </div>
                                                <div class="spacer">
                                                    <img src="../../../Images/spacer.gif" />
                                                </div>
                                                <div class="cBoth">
                                                </div>
                                            </asp:Panel>
                                            <div id="Div1" class="himssuHeader7WireBox col-md-12" runat="server" visible="false" style="width: 100%; height: 100%">
                                                <div id="GridViewPagerDiv" runat="server" visible="True">
                                                    <div class="leftdiv">
                                                    </div>
                                                </div>
                                                <div class="himsBoxContent">
                                                    <div id="Div4" runat="server" class="table-responsive">
                                                        <asp:GridView ID="BiometricStudentAttendanceGridView" runat="server" Width="100%" AutoGenerateColumns="False"
                                                            EmptyDataText="No Records Found !!" OnRowDataBound="BiometricStudentAttendanceGridView_RowDataBound"
                                                            AllowPaging="false" ShowHeader="true" DataKeyNames="AcademicId,AbsentReasonId,AttendanceTagId"
                                                            CssClass="table table-striped table-bordered table-hover">
                                                            <Columns>
                                                                <asp:TemplateField HeaderStyle-HorizontalAlign="Center">
                                                                    <HeaderTemplate>
                                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                                            <asp:CheckBox ID="HeaderSelectCheckBox" onclick="HeaderCheckBoxCheck(this);" runat="server" />
                                                                            <span></span>
                                                                        </label>
                                                                    </HeaderTemplate>
                                                                    <ItemStyle HorizontalAlign="Center" Width="2%" />
                                                                    <ItemTemplate>
                                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                                            <asp:CheckBox ID="SelectCheckBox" runat="server" Checked='<%# Bind("IsDeleted") %>' onclick="SelectCheckBoxCheck(this);" />
                                                                            <span></span>
                                                                        </label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                 <asp:BoundField DataField="StudentCode" HeaderText="Code" ItemStyle-Width="10%" HeaderStyle-HorizontalAlign="Left"></asp:BoundField>
                                                                <asp:BoundField DataField="StudentName" HeaderText="Student Name" ItemStyle-Width="15%" HeaderStyle-HorizontalAlign="Left"></asp:BoundField>
                                                                <asp:BoundField HeaderText="FirstIn" DataField="FirstIn" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemStyle Width="3%" />
                                                                </asp:BoundField>
                                                                <asp:BoundField HeaderText="LastOut" DataField="LastOut" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemStyle Width="3%" />
                                                                </asp:BoundField>
                                                                <asp:BoundField HeaderText="LateBy" DataField="LateBy" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemStyle Width="3%" />
                                                                </asp:BoundField>
                                                                <asp:BoundField HeaderText="Earlyby" DataField="EarlyBy" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemStyle Width="3%" />
                                                                </asp:BoundField>
                                                                
                                                                <asp:BoundField HeaderText="Duration" DataField="Duration" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemStyle Width="3%" />
                                                                </asp:BoundField>
                                                                 <asp:BoundField HeaderText="TimeSheet Status" DataField="PresentStatus" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemStyle Width="3%" />
                                                                </asp:BoundField>
                                                                <asp:TemplateField HeaderText="IsPresent" ItemStyle-Width="2%" ItemStyle-Wrap="true"
                                                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                                                                    <ItemTemplate>
                                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                                            <asp:HiddenField ID="IsPresentHiddenField" runat="server" Value='<%# Bind("IsPresent") %>' />
                                                                            <asp:CheckBox ID="IsPresentCheckBox" runat="server" Checked='<%# Bind("IsPresent") %>' Enabled='<%# Eval("IsDeleted") %>'
                                                                                onclick="IsPresentChechBoxCheck(this);" />
                                                                            <span></span>
                                                                        </label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Attendance" ItemStyle-Width="3%" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemTemplate>
                                                                        <asp:DropDownList runat="server" ID="AttendanceTagDropDownList" SkinID="CustomWidthDropDownList"
                                                                            Width="84px" CssClass="form-control" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()">
                                                                        </asp:DropDownList>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Absent Reason" ItemStyle-Width="5%" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemTemplate>
                                                                        <asp:DropDownList runat="server" ID="AbsentReasonDropDownList" SkinID="CustomWidthDropDownList"
                                                                            Width="84px" CssClass="form-control" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()">
                                                                        </asp:DropDownList>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                
                                                            </Columns>
                                                            <PagerSettings Visible="False" />
                                                        </asp:GridView>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </asp:Panel>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="spacer">
                        <asp:Image ID="Image4" runat="server" ImageUrl="~/Images/spacer.gif" />
                    </div>
                </div>

            </div>
            <div class="spacer">
                <img src="../../../Images/spacer.gif" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <%--<script data-main="../../../JavaScript/rjs/encrypt/employee-register-encrypt" src="../../../JavaScript/rjs/require.js"></script>--%>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/employee-register")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
    <script type="text/javascript">
        function HeaderCheckBoxCheck(obj) {
            var table = document.getElementById('<%=BiometricStudentAttendanceGridView.ClientID %>');
            var chkselect = false;
            if ($(obj).is(':checked'))
                chkselect = true;
            else
                chkselect = false;

            if (chkselect == true) {
                for (var i = 2; i <= table.rows.length ; i++) {
                    if (i < 10) {
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_SelectCheckBox').attr('checked', 'checked');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_SelectCheckBox').prop('checked', true);

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_IsPresentCheckBox').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_AttendanceTagDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_LeaveTypeDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_LeavePeriodDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_AbsentReasonDropDownList').removeAttr('disabled');

                    }
                    else {
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_SelectCheckBox').attr('checked', 'checked');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_SelectCheckBox').prop('checked', true);

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_IsPresentCheckBox').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_AttendanceTagDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_LeaveTypeDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_LeavePeriodDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_AbsentReasonDropDownList').removeAttr('disabled');
                    }
                }
            }
            else if (chkselect == false) {
                for (var i = 2; i <= table.rows.length ; i++) {
                    if (i < 10) {
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_SelectCheckBox').attr('checked', 'checked');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_SelectCheckBox').prop('checked', false);

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_IsPresentCheckBox').attr('disabled', 'disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_AttendanceTagDropDownList').attr('disabled', 'disabled');

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_LeaveTypeDropDownList').attr('disabled', 'disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_LeavePeriodDropDownList').attr('disabled', 'disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_AbsentReasonDropDownList').attr('disabled', 'disabled');
                    }
                    else {
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_SelectCheckBox').attr('checked', 'checked');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_SelectCheckBox').prop('checked', false);

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_IsPresentCheckBox').attr('disabled', 'disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_AttendanceTagDropDownList').attr('disabled', 'disabled');

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_LeaveTypeDropDownList').attr('disabled', 'disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_LeavePeriodDropDownList').attr('disabled', 'disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_AbsentReasonDropDownList').attr('disabled', 'disabled');
                    }
                }
            }

            for (var i = 2; i <= table.rows.length ; i++) {
                if (i < 10) {
                    if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_IsPresentCheckBox').is(':checked') == true) {

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_LeaveTypeDropDownList').prop("selectedIndex", 0);
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_LeaveTypeDropDownList').attr('disabled', 'disabled');

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_LeavePeriodDropDownList').prop("selectedIndex", 0);
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_LeavePeriodDropDownList').attr('disabled', 'disabled');

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_AbsentReasonDropDownList').prop("selectedIndex", 0);
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_AbsentReasonDropDownList').attr('disabled', 'disabled');

                        if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_IsPresentCheckBox').is(':disabled') == false) {
                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_AttendanceTagDropDownList').removeAttr('disabled');
                        }
                    }
                    else if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_IsPresentCheckBox').is(':checked') == false) {

                        if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_SelectCheckBox').is(':checked') == true) {

                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_AbsentReasonDropDownList').removeAttr('disabled');
                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_LeaveTypeDropDownList').removeAttr('disabled');
                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_LeavePeriodDropDownList').removeAttr('disabled');
                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_AttendanceTagDropDownList').attr('disabled', 'disabled');
                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + i + '_AttendanceTagDropDownList').prop("selectedIndex", 0);

                        }
                    }
                }
                else {
                    if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_IsPresentCheckBox').is(':checked') == true) {

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_LeaveTypeDropDownList').prop("selectedIndex", 0);
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_LeaveTypeDropDownList').attr('disabled', 'disabled');

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_LeavePeriodDropDownList').prop("selectedIndex", 0);
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_LeavePeriodDropDownList').attr('disabled', 'disabled');

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_AbsentReasonDropDownList').prop("selectedIndex", 0);
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_AbsentReasonDropDownList').attr('disabled', 'disabled');

                        if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_IsPresentCheckBox').is(':disabled') == false) {
                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_AttendanceTagDropDownList').removeAttr('disabled');
                        }
                    }
                    else if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_IsPresentCheckBox').is(':checked') == false) {

                        if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_SelectCheckBox').is(':checked') == true) {

                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_AbsentReasonDropDownList').removeAttr('disabled');
                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_LeaveTypeDropDownList').removeAttr('disabled');
                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_LeavePeriodDropDownList').removeAttr('disabled');
                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_AttendanceTagDropDownList').attr('disabled', 'disabled');
                            $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + i + '_AttendanceTagDropDownList').prop("selectedIndex", 0);

                        }
                    }
                }
            }
        }

        function SelectCheckBoxCheck(obj) {
            var table = document.getElementById('<%=BiometricStudentAttendanceGridView.ClientID %>');
            var RowIndex = $(obj).closest('td').parent()[0].sectionRowIndex + 1;

            var chkselect = false;
            if ($(obj).is(':checked'))
                chkselect = true;
            else
                chkselect = false;

            if (chkselect == true) {
                if (RowIndex < 10) {

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_IsPresentCheckBox').removeAttr('disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AttendanceTagDropDownList').removeAttr('disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeaveTypeDropDownList').removeAttr('disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeavePeriodDropDownList').removeAttr('disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AbsentReasonDropDownList').removeAttr('disabled');

                }
                else {

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_IsPresentCheckBox').removeAttr('disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AttendanceTagDropDownList').removeAttr('disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeaveTypeDropDownList').removeAttr('disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeavePeriodDropDownList').removeAttr('disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AbsentReasonDropDownList').removeAttr('disabled');
                }
            }
            else if (chkselect == false) {
                if (RowIndex < 10) {

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_IsPresentCheckBox').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AttendanceTagDropDownList').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeaveTypeDropDownList').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeavePeriodDropDownList').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AbsentReasonDropDownList').attr('disabled', 'disabled');
                }
                else {

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_IsPresentCheckBox').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AttendanceTagDropDownList').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeaveTypeDropDownList').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeavePeriodDropDownList').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AbsentReasonDropDownList').attr('disabled', 'disabled');
                }
            }

            if (RowIndex < 10) {
                if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_IsPresentCheckBox').is(':checked') == true) {

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeaveTypeDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeaveTypeDropDownList').attr('disabled', 'disabled');

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeavePeriodDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeavePeriodDropDownList').attr('disabled', 'disabled');

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AbsentReasonDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AbsentReasonDropDownList').attr('disabled', 'disabled');

                    if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_IsPresentCheckBox').is(':disabled') == false) {
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AttendanceTagDropDownList').removeAttr('disabled');
                    }
                }
                else if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_IsPresentCheckBox').is(':checked') == false) {

                    if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_SelectCheckBox').is(':checked') == true) {

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AbsentReasonDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeaveTypeDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeavePeriodDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AttendanceTagDropDownList').attr('disabled', 'disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AttendanceTagDropDownList').prop("selectedIndex", 0);
                    }
                }
            }
            else {
                if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_IsPresentCheckBox').is(':checked') == true) {

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeaveTypeDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeaveTypeDropDownList').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeavePeriodDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeavePeriodDropDownList').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AbsentReasonDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AbsentReasonDropDownList').attr('disabled', 'disabled');

                    if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_IsPresentCheckBox').is(':disabled') == false) {
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AttendanceTagDropDownList').removeAttr('disabled');
                    }
                }
                else if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_IsPresentCheckBox').is(':checked') == false) {

                    if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_SelectCheckBox').is(':checked') == true) {

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AbsentReasonDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeaveTypeDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeavePeriodDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AttendanceTagDropDownList').attr('disabled', 'disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AttendanceTagDropDownList').prop("selectedIndex", 0);
                    }
                }
            }
        }

        function IsPresentChechBoxCheck(obj) {
            var table = document.getElementById('<%=BiometricStudentAttendanceGridView.ClientID %>');
            var RowIndex = $(obj).closest('td').parent()[0].sectionRowIndex + 1;

            var chkselect = false;
            if ($(obj).is(':checked'))
                chkselect = true;
            else
                chkselect = false;

            if (RowIndex < 10) {
                if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_IsPresentCheckBox').is(':checked') == true) {

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeaveTypeDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeaveTypeDropDownList').attr('disabled', 'disabled');

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeavePeriodDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeavePeriodDropDownList').attr('disabled', 'disabled');

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AbsentReasonDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AbsentReasonDropDownList').attr('disabled', 'disabled');

                    if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_IsPresentCheckBox').is(':disabled') == false) {
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AttendanceTagDropDownList').removeAttr('disabled');

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_IsPresentHiddenField').val("True");
                    }
                }
                else if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_IsPresentCheckBox').is(':checked') == false) {

                    if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_SelectCheckBox').is(':checked') == true) {

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AbsentReasonDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeaveTypeDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_LeavePeriodDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AttendanceTagDropDownList').attr('disabled', 'disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_AttendanceTagDropDownList').prop("selectedIndex", 0);

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl0' + RowIndex + '_IsPresentHiddenField').val("False");
                    }
                }
            }
            else {
                if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_IsPresentCheckBox').is(':checked') == true) {

                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeaveTypeDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeaveTypeDropDownList').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeavePeriodDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeavePeriodDropDownList').attr('disabled', 'disabled');
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AbsentReasonDropDownList').prop("selectedIndex", 0);
                    $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AbsentReasonDropDownList').attr('disabled', 'disabled');

                    if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_IsPresentCheckBox').is(':disabled') == false) {
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AttendanceTagDropDownList').removeAttr('disabled');

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_IsPresentHiddenField').val("True");
                    }
                }
                else if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_IsPresentCheckBox').is(':checked') == false) {

                    if ($('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_SelectCheckBox').is(':checked') == true) {

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AbsentReasonDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeaveTypeDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_LeavePeriodDropDownList').removeAttr('disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AttendanceTagDropDownList').attr('disabled', 'disabled');
                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_AttendanceTagDropDownList').prop("selectedIndex", 0);

                        $('#ctl00_CP_BiometricStudentAttendanceGridView_ctl' + RowIndex + '_IsPresentHiddenField').val("False");
                    }
                }
            }
        }
    </script>
</asp:Content>
