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


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>


        <script type="text/javascript">
            // when a one more row is selected
            function OnRowSelected(sender, args) {
                setTimeout(function () {

                    // only make a postback because we need to execute a logic on the server-side
                    __doPostBack('<%= RadGrid1.ClientID %>', '');

                }, 300)
            }
        </script>
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowMultiRowSelection="true" AllowPaging="True" Width="800px" OnNeedDataSource="RadGrid1_NeedDataSource" ShowFooter="true" 
            
            OnPreRender="RadGrid1_PreRender">
            <ClientSettings>
                <Selecting AllowRowSelect="true" />
                <ClientEvents OnRowSelected="OnRowSelected" />
            </ClientSettings>
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="OrderID">
                <Columns>
                    <telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32" Aggregate="Sum"
                        FilterControlAltText="Filter OrderID column" HeaderText="OrderID"
                        ReadOnly="True" SortExpression="OrderID" UniqueName="OrderID">
                    </telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn DataField="OrderDate" DataType="System.DateTime"
                        FilterControlAltText="Filter OrderDate column" HeaderText="OrderDate"
                        SortExpression="OrderDate" UniqueName="OrderDate">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridNumericColumn DataField="Freight" DataType="System.Decimal" Aggregate="Sum"
                        FilterControlAltText="Filter Freight column" HeaderText="Freight"
                        SortExpression="Freight" UniqueName="Freight">
                    </telerik:GridNumericColumn>
                    <telerik:GridBoundColumn DataField="ShipName"
                        FilterControlAltText="Filter ShipName column" HeaderText="ShipName" Aggregate="Count"
                        SortExpression="ShipName" UniqueName="ShipName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ShipCountry"
                        FilterControlAltText="Filter ShipCountry column" HeaderText="ShipCountry"
                        SortExpression="ShipCountry" UniqueName="ShipCountry">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </form>
</body>
</html>
