<%@ page language="C#" autoeventwireup="true" inherits="Pages_FeeManagement_FeeSetupFeeWise, App_Web_5bdgwwvd" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage_new.master" uiculture="auto" meta:resourcekey="PageResource1" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Src="~/UserControls/DatePicker/DatePickerControl.ascx" TagName="DatePickerControl" TagPrefix="Date" %>
<%@ Register Src="~/UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/AutoComplete/AutoCompleteControl.ascx" TagName="AutoCompleteControl" TagPrefix="acc" %>
<%@ Register Src="~/UserControls/Common/CommonSearch/CommonSearch.ascx" TagName="CommonSearchUserControl" TagPrefix="Common" %>
<%@ Register Src="~/UserControls/Common/EmployeeSearch/EmployeeSearch.ascx" TagName="EmployeeSearchControl" TagPrefix="hims" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl" TagPrefix="ScreenGroup" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <asp:UpdatePanel ID="OTQueueListingUpdatePanel" runat="server">
        <ContentTemplate>
            <hims:EmployeeSearchControl ID="EmployeeSearch" Visible="false" runat="server" />
            <Common:CommonSearchUserControl ID="CommonSearchControl" runat="server" Visible="false" />
            <div id="divContentPage" class="divcontentpagemargin">
                <div class="dashBoardLeftCont">
                    <div class="himssuHeader3WireBox">
                        <table>
                            <ScreenGroup:ScreenGroupControl EnableViewState="true" ID="ScreenGroupControl" ScreenGroupId="104"
                                Visible="true" runat="server" />
                        </table>
                    </div>
                </div>
                <div class="whiteboxpaddingleft row">
                    <div class="himssuHeader1WireBox card card-box">
                        <div class="himsBoxHeader card-head">
                            <div class="leftdiv">
                            </div>
                            <div class="himsBoxTitle">
                                <div class="headerText">
                                    <header>
                                        <asp:Label ID="ReasonMasterDetailLabel" runat="server" Text="Fee Setup Fee Wise"></asp:Label>
                                    </header>
                                </div>
                            </div>
                        </div>
                        <div class="himsBoxContent card-body">
                            <div class="contentHolder">
                                <div class="outerBox pTop5 col-md-3">
                                    <div class="controlLabelWidth">
                                        <asp:Label ID="OrganizationLabel" Text="Organization" runat="server" SkinID="MandatoryLabel"></asp:Label>
                                    </div>
                                    <div class="fLeft pRight5">
                                        <asp:DropDownList ID="OrganizationDropDownList" runat="server" onmouseleave="showHideTooltip()"
                                            onmouseenter="showHideTooltip()" AutoPostBack="true" SkinID="CustomWidthDropDownList"
                                            class="form-control" OnSelectedIndexChanged="OrganizationDropDownList_OnSelectedIndexChanged">
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <div class="outerBox pTop5 col-md-3">
                                    <div class="controlLabelWidth">
                                        <asp:Label ID="BatchLable" Text="Batch" runat="server" SkinID="MandatoryLabel"></asp:Label>
                                    </div>
                                    <div class="fLeft pRight5">
                                        <asp:DropDownList ID="BatchDropDownList" runat="server" onmouseleave="showHideTooltip()"
                                            onmouseenter="showHideTooltip()" SkinID="CustomWidthDropDownList" class="form-control"
                                            AutoPostBack="true" OnSelectedIndexChanged="BatchDropDownList_OnSelectedIndexChanged">
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <div class="outerBox pTop5 col-md-3">
                                    <div class="controlLabelWidth">
                                        <asp:Label ID="AdmissionCategoryLabel" runat="server" Text="Fees Category" SkinID="MandatoryLabel"> </asp:Label>
                                    </div>
                                    <div class="fLeft pRight5">
                                        <asp:DropDownList runat="server" ID="AdmissionCategoryDropDownList" SkinID="CustomWidthDropDownList"
                                            onmouseleave="showHideTooltip()" class="form-control" onmouseenter="showHideTooltip()"
                                            AutoPostBack="true" OnSelectedIndexChanged="AdmissionCategoryDropDownList_SelectedIndexChanged">
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <div class="outerBox pTop5 col-md-3">
                                    <div class="controlLabelWidth">
                                        <asp:Label ID="FeeLabel" runat="server" SkinID="MandatoryLabel" Text="Fee"></asp:Label>
                                    </div>
                                    <div class="fLeft pRight5">
                                        <asp:DropDownList runat="server" ID="FeeDropDownList" SkinID="CustomWidthDropDownList"
                                            AutoPostBack="true" onmouseleave="showHideTooltip()" class="form-control" onmouseenter="showHideTooltip()" OnSelectedIndexChanged="FeeDropDownList_SelectedIndexChanged">
                                        </asp:DropDownList>
                                    </div>
                                </div>

                                <div id="FeeSetupDetailDiv" runat="server" visible="false">
                                    <%--  <div class="alert alert-info col-md-12">
                                        <i class="material-icons">info</i>
                                        <asp:Label ID="NoteLabel" runat="server" Text="| Record are sorted by start date,Fee Head Order and Fee Order."></asp:Label><br />
                                    </div>--%>

                                    <div class="himssuHeader6WireBox  pTop5">
                                        <div class="himsBoxHeader card-head inner" id="GridViewPagerDiv" runat="server" visible="false">
                                            <div class="leftdiv">
                                            </div>
                                            <%--   <div class="himsBoxTitle">
                                                <div class="gridHeaderText">
                                                    <header>
                                                        <asp:Label ID="GridViewLabel" Text="List" runat="server" />
                                                    </header>
                                                    </div>
                                                </div>--%>
                                            <div class="pull-right col-md-6 display-flex">
                                                <asp:DropDownList ID="ApplyDropDownList" runat="server" SkinID="CustomWidthDropDownList"
                                                    CssClass="form-control mt-10">
                                                    <asp:ListItem Text="- Select -" Value="-1" Selected="True"></asp:ListItem>
                                                    <asp:ListItem Text="Amount" Value="1"></asp:ListItem>
                                                    <asp:ListItem Text="Start Date" Value="2"></asp:ListItem>
                                                    <asp:ListItem Text="End Date" Value="3"></asp:ListItem>
                                                    <asp:ListItem Text="Receipt Book" Value="4"></asp:ListItem>
                                                    <%--<asp:ListItem Text="Collection Group" Value="5"></asp:ListItem>--%>
                                                    <asp:ListItem Text="Fee Duration" Value="6"></asp:ListItem>
                                                    <asp:ListItem Text="Level Amount" Value="7"></asp:ListItem>
                                                </asp:DropDownList>
                                                &nbsp;&nbsp;&nbsp;&nbsp;
                                                    <asp:TextBox ID="ApplyAllTextBox" runat="server" ClientIDMode="Static" MaxLength="15" class="pTop5"
                                                        SkinID="CustomWidthTextBox"></asp:TextBox>&nbsp;&nbsp;&nbsp;&nbsp;
                                                    <asp:Button ID="ApplyAllButton" runat="server" OnClick="ApplyAllButton_Click"
                                                        Text="Apply All" SkinID="0" CssClass="btn btn-apply" />
                                            </div>

                                        </div>
                                    </div>
                                    <asp:HiddenField ID="IsFeeHeadExpenseValuesHiddenField" runat="server" />
                                    <div class="himsBoxContent pTop5">
                                        <div id="Div5" runat="server" visible="true" class="table-responsive">
                                            <asp:GridView ID="FeeSetupGridView" runat="server" AutoGenerateColumns="False"
                                                EmptyDataText="No Records Found !!" AllowPaging="False" OnRowDataBound="FeeSetupGridView_RowDataBound"
                                                DataKeyNames="Id,ClassId,IsReceiptBookChange" ShowHeader="True" ShowFooter="true"
                                                CssClass="table table-striped table-bordered table-hover">
                                                <Columns>
                                                    <asp:TemplateField HeaderText="Select" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="5%"
                                                        ItemStyle-Wrap="true">
                                                        <HeaderTemplate>
                                                            <label class="rt-chkbox rt-chkbox-single rt-chkbox-outline">
                                                                <asp:CheckBox ID="HeaderSelectCheckBox" runat="server" Enabled="true" AutoPostBack="true"
                                                                    Visible="true" OnCheckedChanged="HeaderSelectCheckBox_checked" />
                                                                <span></span>
                                                            </label>
                                                        </HeaderTemplate>
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <ItemTemplate>
                                                            <label class="rt-chkbox rt-chkbox-single rt-chkbox-outline">
                                                                <asp:CheckBox ID="SelectCheckBox" AutoPostBack="false" OnCheckedChanged="SelectCheckBox_Checked" onclick="Check(this);"
                                                                    runat="server" />
                                                                <asp:HiddenField ID="hdID" Value='<%#Eval("Id") %>' runat="server" />
                                                                <span></span>
                                                            </label>
                                                            
                                                            <asp:HiddenField ID="IsReceiptBookChangeHiddenField" runat="server" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:BoundField DataField="ClassName" HeaderText="Class Name" ItemStyle-Width="10%" HeaderStyle-HorizontalAlign="Left"></asp:BoundField>
                                                    <asp:TemplateField HeaderText="Optional" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="5%"
                                                        ItemStyle-Wrap="true">
                                                         <HeaderTemplate>
                                                            <label class="rt-chkbox rt-chkbox-single rt-chkbox-outline">
                                                                  <bdo>Optional</bdo>
                                                                <asp:CheckBox ID="HeaderOptionalSelectCheckBox" runat="server" Enabled="false" AutoPostBack="true" OnCheckedChanged="HeaderOptionalSelectCheckBox_CheckedChanged"/>
                                                                <span></span>
                                                            </label>
                                                        </HeaderTemplate>
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <ItemTemplate>
                                                            <label class="rt-chkbox rt-chkbox-single rt-chkbox-outline">
                                                                <asp:CheckBox ID="IsOptionalCheckBox" Checked='<%#Eval("IsOptional")%>' Enabled="false" runat="server" />
                                                                <span></span>
                                                            </label>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Variable" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="5%"
                                                        ItemStyle-Wrap="true">
                                                         <HeaderTemplate>
                                                            <label class="rt-chkbox rt-chkbox-single rt-chkbox-outline">
                                                                  <bdo>Variable</bdo>
                                                                <asp:CheckBox ID="HeaderVariableSelectCheckBox" runat="server" Enabled="false" AutoPostBack="true" OnCheckedChanged="HeaderVariableSelectCheckBox_CheckedChanged"/>
                                                                <span></span>
                                                            </label>
                                                        </HeaderTemplate>
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <ItemTemplate>
                                                            <label class="rt-chkbox rt-chkbox-single rt-chkbox-outline">
                                                                <asp:CheckBox ID="IsVariableCheckBox" Checked='<%#Eval("IsVariable")%>' AutoPostBack="false"
                                                                    Enabled="false" runat="server" OnCheckedChanged="VariableCheckBox_Checked" onclick="VariableCheck(this);" />
                                                                <span></span>
                                                            </label>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Amount" ItemStyle-Width="10%" ItemStyle-Wrap="true">
                                                        <ItemTemplate>
                                                            <asp:TextBox ID="AmountTextBox" runat="server" MaxLength="15" onKeypress="javascript:return MaskDecimal(event,12,2)"></asp:TextBox>
                                                        </ItemTemplate>
                                                        <FooterTemplate>
                                                            <asp:Label ID="TotalAmountLabel" runat="server"></asp:Label>
                                                        </FooterTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Start Date" ItemStyle-Width="10%" ItemStyle-Wrap="true">
                                                        <ItemTemplate>
                                                            <asp:TextBox ID="StartDateTextBox" onkeyup="FormatIt(this);" runat="server" Width="100px" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="End Date" ItemStyle-Width="10%" ItemStyle-Wrap="true">
                                                        <ItemTemplate>
                                                            <asp:TextBox ID="EndDateTextBox" runat="server" onkeyup="FormatIt(this);" DisplayDatePicker="false"
                                                                Width="100px" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Receipt Book" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="10%"
                                                        ItemStyle-Wrap="true">
                                                        <ItemStyle HorizontalAlign="Left" />
                                                        <ItemTemplate>
                                                            <asp:DropDownList runat="server" ID="ReceiptBookDropDownList" onmouseleave="showHideTooltip()"
                                                                onmouseenter="showHideTooltip()" Enabled="false" OnSelectedIndexChanged="ReceiptBookDropDownList_SelectedIndexChanged" AutoPostBack="false" class="form-control" Onchange="GetCollectionGroupDropDownList(this);">
                                                            </asp:DropDownList>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Collection Group" HeaderStyle-HorizontalAlign="Left"
                                                        ItemStyle-Width="10%" ItemStyle-Wrap="true">
                                                        <ItemStyle HorizontalAlign="Left" />
                                                        <ItemTemplate>
                                                            <asp:DropDownList runat="server" ID="CollectionGroupDropDownList" onmouseleave="showHideTooltip()"
                                                                onmouseenter="showHideTooltip()" Enabled="false" class="form-control" onchange="CollectionGroupChange(this);">
                                                            </asp:DropDownList>
                                                            <asp:HiddenField runat="server" ID="CollectionGroupValue" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Service Tax" HeaderStyle-HorizontalAlign="Center"
                                                        ItemStyle-Width="5%" ItemStyle-Wrap="true">
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <ItemTemplate>
                                                            <label class="rt-chkbox rt-chkbox-single rt-chkbox-outline">
                                                                <asp:CheckBox ID="IsServiceTaxCheckBox" Checked='<%#Eval("IsServiceTax")%>' runat="server" />
                                                                <span></span>
                                                            </label>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Fee Duration" HeaderStyle-HorizontalAlign="Center"
                                                        ItemStyle-Width="10%" ItemStyle-Wrap="true">
                                                        <ItemStyle HorizontalAlign="Center" />
                                                        <ItemTemplate>
                                                            <asp:TextBox ID="FeeDurationTextBox" runat="server" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Level Amount" ItemStyle-Width="10%" ItemStyle-Wrap="true">
                                                        <ItemTemplate>
                                                            <asp:TextBox ID="LevelAmountTextBox" runat="server" MaxLength="15" onKeypress="javascript:return MaskDecimal(event,12,2)"></asp:TextBox>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>
                                                <PagerSettings Visible="False" />
                                            </asp:GridView>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            </div>
            </div>
            
        </ContentTemplate>
    </asp:UpdatePanel>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/fee-setup")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
    <script>
        function Check(obj) {

            var table = document.getElementById('<%=FeeSetupGridView.ClientID %>');
            var IsFeeHeadExpenseValue = document.getElementById('<%=IsFeeHeadExpenseValuesHiddenField.ClientID %>').value;
            var chk = false;
            if ($(obj).is(':checked'))
                chk = true;
            else
                chk = false;
            var row = obj.parentNode.parentNode.parentNode.rowIndex + 1;
            RowIndex = row - 2;

            feesetupId = obj.nextElementSibling.value;
            batchid = $('#ctl00_CP_BatchDropDownList').val();
            AdmissionCategoryId = $('#ctl00_CP_AdmissionCategoryDropDownList').val();
            FeeId = $('#ctl00_CP_FeeDropDownList').val();

            if (row < 10)
                row = "0" + row;

            if (chk == true) {
                $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_IsOptionalCheckBox').removeAttr('disabled');
                $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_IsVariableCheckBox').removeAttr('disabled');
                $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_AmountTextBox').removeAttr('disabled');
                $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_StartDateTextBox').removeAttr('disabled');
                $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_EndDateTextBox').removeAttr('disabled');
                $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_IsServiceTaxCheckBox').removeAttr('disabled');
                $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_CollectionGroupDropDownList').removeAttr('disabled');
                $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_FeeDurationTextBox').removeAttr('disabled');

                if ($('#ctl00_CP_FeeSetupGridView_ctl' + row + '_IsReceiptBookChangeHiddenField').val() == "True")
                    $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_ReceiptBookDropDownList').removeAttr('disabled');
                else
                    $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_ReceiptBookDropDownList').attr('disabled', 'disabled');

                if (IsFeeHeadExpenseValue == "true")
                    $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_LevelAmountTextBox').removeAttr('disabled');
                else
                    $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_LevelAmountTextBox').attr('disabled', 'disabled');
            }
            else {

                $.ajax({
                    type: "POST",
                    url: "FeeSetupFeeWise.aspx/SelectCheckBoxChecked",
                    data: JSON.stringify({ "RowIndex": row, "FeeId": parseInt(FeeId), "BatchId": parseInt(batchid), "AdmissionCategoryId": parseInt(AdmissionCategoryId), "FeeSetupId": parseInt(feesetupId) }),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {

                        if (data.d.returnCode == "1") {

                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_IsOptionalCheckBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_IsVariableCheckBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_AmountTextBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_StartDateTextBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_EndDateTextBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_IsServiceTaxCheckBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_CollectionGroupDropDownList').attr('disabled', 'disabled');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_FeeDurationTextBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_LevelAmountTextBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_ReceiptBookDropDownList').attr('disabled', 'disabled');

                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_IsOptionalCheckBox').removeAttr('checked');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_IsVariableCheckBox').removeAttr('checked');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_IsServiceTaxCheckBox').removeAttr('checked');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_AmountTextBox').val('');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_StartDateTextBox').val('');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_EndDateTextBox').val('');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_FeeDurationTextBox').val('');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_LevelAmountTextBox').val('');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_CollectionGroupDropDownList').val('-1');
                            $('#ctl00_CP_FeeSetupGridView_ctl' + row + '_ReceiptBookDropDownList').val('-1');

                            var row1 = obj.parentNode.parentNode.parentNode;
                            var state = row1.cells[8].getElementsByTagName("select")[0];
                            $(state).html("");
                            $(state).append($("<option></option>").val("-1").html("- Select -"));

                            //enableControls(row);
                        }

                        else if (data.d.returnCode == "-50") {
                            alert('Referred in Fee Allocation can not be deleted');
                            $(obj).attr('checked', 'checked');
                            $(obj).prop("checked", true);
                            //disableControls(row);
                        }
                        else if (data.d.returnCode == "-51") {
                            alert('Referred in Fee Receipt can not be deleted');
                            $(obj).attr('checked', 'checked');
                            $(obj).prop('checked', true);
                            //disableControls(row);
                        }
                        else if (data.d.returnCode == "-52") {
                            alert('Referred in Optional Fee can not be deleted');
                            $(obj).attr('checked', 'checked');
                            $(obj).prop('checked', true);
                            //disableControls(row);
                        }
                        else if (data.d.returnCode == "-53") {
                            alert('Referred in Online Fee can not be deleted');
                            $(obj).attr('checked', 'checked');
                            $(obj).prop('checked', true);
                            //disableControls(row);
                        }
                    },
                    error: function (xhr, status, error) {
                        var err = eval("(" + xhr.responseText + ")");
                        console.log(err.Message);
                    }
                });
            }
        }

        function GetCollectionGroupDropDownList(obj) {
            var row = obj.parentNode.parentNode;
            var rowIndex = row.rowIndex - 1;
            var state = row.cells[8].getElementsByTagName("select")[0];
            $.ajax({
                type: "POST",
                url: "/Pages/FeeManagement/FeeSetupFeeWise.aspx/FillCollectionGroupDropDownList",
                data: '{"Id":"' + $(obj).val() + '"}',
                contentType: "application/json;charset=utf-8",
                dataType: "json",
                success: function (data) {
                    var datas = $.parseJSON(data.d);
                    $(state).html("");
                    $(state).append($("<option></option>").val("-1").html("- Select -"));
                    $.each(datas, function (index, itemData) {
                        $(state).append($("<option></option>").val(itemData['Id']).html(itemData['Title']));
                    });
                }
            });
        }
        function VariableCheck(obj) {
            var chk = false;
            if ($(obj).is(':checked'))
                chk = true;
            else
                chk = false;
            var row1 = obj.parentNode.parentNode.parentNode;
            var state = row1.cells[4].getElementsByTagName("input")[0];
            if (chk == true)
            {
                $(state).attr('disabled', 'disabled');
                $(state).val('');
            }
            else
            {
                $(state).removeAttr('disabled');
            }
        }

        function CollectionGroupChange(obj) {
            var row = obj.parentNode.parentNode;
            var rowIndex = row.rowIndex - 1;
            var state = row.cells[8].getElementsByTagName("input")[0];
            state.value = obj.value;
        }
    </script>
</asp:Content>
