<%@ 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>
     <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function ExpandCollapseFirstMasterTableViewItem()
            {
                var firstMasterTableViewRow = $find("<%= RadGrid1.MasterTableView.ClientID %>").get_dataItems()[0];
                if(firstMasterTableViewRow.get_expanded())
                {
                    firstMasterTableViewRow.set_expanded(false);             
                    //rgExpand
                }
                else
                {
                    firstMasterTableViewRow.set_expanded(true);
             
                    //rgCollapse
                }
            }
    
        </script>
    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager>
    <div>
        
        <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" Skin="Vista"
            Width="95%" AutoGenerateColumns="False" PageSize="3" AllowSorting="True" AllowMultiRowSelection="False"
            AllowPaging="True" GridLines="None" AllowAutomaticUpdates="true">
            <PagerStyle Mode="NumericPages"></PagerStyle>          
            <MasterTableView ClientDataKeyNames="CustomerID" DataSourceID="SqlDataSource1" DataKeyNames="CustomerID" AllowMultiColumnSorting="True"
                HierarchyLoadMode="Client" Width="100%" EditMode="PopUp">             
                <Columns>
                    <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn SortExpression="CustomerID" HeaderText="CustomerID" HeaderButtonType="TextButton"
                        DataField="CustomerID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="ContactName" HeaderText="Contact Name" HeaderButtonType="TextButton"
                        DataField="ContactName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="CompanyName" HeaderText="Company" HeaderButtonType="TextButton"
                        DataField="CompanyName">
                    </telerik:GridBoundColumn>
                </Columns>
                <SortExpressions>
                    <telerik:GridSortExpression FieldName="CompanyName"></telerik:GridSortExpression>
                </SortExpressions>
                <EditFormSettings EditFormType="WebUserControl" UserControlName="WebUserControl.ascx"></EditFormSettings>
            </MasterTableView>
        </telerik:RadGrid>
        
        
        
         <asp:SqlDataSource ID="SqlDataSource1"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Customers"
            runat="server"></asp:SqlDataSource>
            
        
    </div>
    </form>
</body>
</html>
