<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>

        <script type="text/javascript">
        function GridCreated(sender, eventArgs)
        {
            if(sender.get_masterTableView().get_dataItems().length > 0)
            {
                document.getElementById("message").innerHTML = "records displayed: " + sender.get_masterTableView().get_dataItems().length;
            }
            else
            {
                document.getElementById("message").innerHTML = "records displayed: " + sender.get_masterTableView().get_dataItems().length;
            }
        }        
        </script>

        <div id="message">
        </div>
        <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource"
            AllowPaging="true">
            <MasterTableView DataKeyNames="CustomerID" ClientDataKeyNames="CustomerID" AutoGenerateColumns="false">
                <Columns>
                    <telerik:GridBoundColumn HeaderText="CustomerID" DataField="CustomerID" UniqueName="CustomerID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="CompanyName" DataField="CompanyName" UniqueName="CompanyName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="ContactName" DataField="ContactName" UniqueName="ContactName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="ContactTitle" DataField="ContactTitle" UniqueName="ContactTitle">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnGridCreated="GridCreated" />
            </ClientSettings>
        </telerik:RadGrid>
    </form>
</body>
</html>
