<%@ page language="C#" autoeventwireup="true" inherits="Forms_GridTest, App_Web_3rcndjza" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
    <title></title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

    <%--<script type="text/javascript">
        $(function () {
            $.ajax({
                type: "POST",
                url: "Dashboard.aspx/GetDataType1",
                data: '{"BoxID":"477315716271","UserID":"10610"}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: OnSuccess,
                failure: function (response) {
                    alert(response.d);
                },
                error: function (response) {
                    alert(response.d);
                }
            });
        });

        function OnSuccess(response) {
            debugger;
            var xmlDoc = $.parseXML(response.d);
            var xml = $(xmlDoc);
            var customers = xml.find("Table");
            var row = $("[id*=gvCustomers] tr:last-child").clone(true);
            $("[id*=gvCustomers] tr").not($("[id*=gvCustomers] tr:first-child")).remove();
            $.each(customers, function () {
                var customer = $(this);
                $("td", row).eq(0).html($(this).find("InputType").text());
                $("td", row).eq(1).html($(this).find("InputDescription").text());
                $("td", row).eq(2).html($(this).find("InputActiveStatus").text());
                $("[id*=gvCustomers]").append(row);
                row = $("[id*=gvCustomers] tr:last-child").clone(true);
            });
        }
    </script>--%>

    <script type="text/javascript">
        var DeviceTypeMake = "";
        $(function () {
            GetMonitorData("477315716271", "10610", "1");
        });
        function GenInput(BoxID, UserID, DeviceType) {
            DeviceTypeMake = DeviceType;
            var isbusness;
            $.ajax({
                type: "POST",
                url: "Dashboard.aspx/GetInputValues",
                contentType: "application/json; charset=utf-8",
                data: '{"BoxID":"' + BoxID + '","UserID":"' + UserID + '"}',
                dataType: "json",
                success: AjaxGenInputSucceeded,
                error: AjaxGenInputFailed
            });
        }
        function AjaxGenInputSucceeded(result) {
            GenInput(result);
        }
        function AjaxGenInputFailed(result) {
            alert('Failed to load');
        }
        function GenInput(result) {
            var items = JSON.parse(result.d);
            BindGenInput(items);
        }

        function BindGenInput(BusinessList) {
            var counter = 0;
            $('#grddata').empty();
            $('#grddata').append('<table class="table table-bordered" style="border-collapse:collapse;background-color: #404040; color: white;" cellspacing="0" align="Center" rules="all" border="1"><tr><td><strong>Input</strong></td><td><strong>Description</strong></td><td><strong>Active</strong></td><td><strong>State</strong></td></tr>')
            $(BusinessList).each(function () {
                if (this.Text == "InputType") {
                    $('#grddata').append('<tr><td>' + this.Value + '</td>');
                }
                if (this.Text == "InputDescription") {
                    $('#grddata').append('<td>' + this.Value + '</td>');
                }
                if (this.Text == "InputActiveStatus") {
                    $('#grddata').append('<td>' + this.Value + '</td>');
                }
                if (this.Text == "InputState") {
                    $('#grddata').append('<td>' + this.Value + '</td></tr>');
                }
            });

            $('#grddata').append('</table>')
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>

            <%-- <asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="false" Font-Names="Arial"
                Font-Size="10pt" RowStyle-BackColor="#A1DCF2" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White">
                <Columns>
                    <asp:BoundField ItemStyle-Width="150px" DataField="InputType" HeaderText="CustomerID" />
                    <asp:BoundField ItemStyle-Width="150px" DataField="InputDescription" HeaderText="ContactName" />
                    <asp:BoundField ItemStyle-Width="150px" DataField="InputActiveStatus" HeaderText="City" />
                </Columns>
            </asp:GridView>--%>
        </div>
        <div id="grddata"></div>
    </form>
</body>
</html>
