This is a migrated thread and some comments may be shown as answers.

Slow page load, hierarchyloadmode=ServerOnDemand seems not working

1 Answer 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Start Informatica c.a.
Top achievements
Rank 1
Start Informatica c.a. asked on 24 Feb 2017, 05:43 PM

Hi, I have a page with 3 nested radgrids. The problem is that the page takes 10 minutes (!!!) to load even if I set HierarchyLoadMode="ServerOnDemand" in every levels. It looks like grid loads every sub-details on page load, also because if I'll set HierarchyLoadMode="Client" the time to load is pretty the same. 

What I'm expecting is that on pageload radgrid loads only the first level and when I click on a row to expand it the page reloads with only that row expanded (and calculated) and so on...

Can you help me?

 

<%@ Page Title="Situazione" Language="VB" AutoEventWireup="false" CodeFile="MostraSituazioneTarget.aspx.vb" Inherits="MostraSituazioneTarget" MasterPageFile="~/Site.master" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <h2>Situazione target</h2>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadScriptBlock runat="server">
        <script type="text/javascript">
 
            window.onresize = ResizeGrid;
            Sys.Application.add_load(ResizeGrid);
 
            function ResizeGrid() {
                var radGrid2 = $find('<%= radGridPrenotazioni.ClientID %>'); //outer RadGrid
 
                if ($(window).height() > 550 & !detectmob()) {
                    radGrid2.get_element().style.height = $(window).height() - 220 + "px";
                    radGrid2.repaint();
                }
 
            }
 
            function detectmob() {
                if (navigator.userAgent.match(/Android/i)
                || navigator.userAgent.match(/webOS/i)
                || navigator.userAgent.match(/iPhone/i)
                || navigator.userAgent.match(/iPad/i)
                || navigator.userAgent.match(/iPod/i)
                || navigator.userAgent.match(/BlackBerry/i)
                || navigator.userAgent.match(/Windows Phone/i)
                ) {
                    return true;
                }
                else {
                    return false;
                }
            }
 
 
        </script>
 
    </telerik:RadScriptBlock>
 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Bootstrap">
    </telerik:RadWindowManager>
    <telerik:RadGrid runat="server" ID="radGridPrenotazioni" Culture="it-IT" EnableViewState="false"
        DataSourceID="SqlDataSource1" GroupPanelPosition="Top" CellSpacing="-1" AllowSorting="True" AutoGenerateColumns="False" ShowGroupPanel="false">
 
        <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" AllowDragToGroup="True" Scrolling-UseStaticHeaders="true" Scrolling-AllowScroll="true"></ClientSettings>
 
        <MasterTableView DataSourceID="SqlDataSource1" ShowGroupFooter="false" GroupsDefaultExpanded="false" HierarchyDefaultExpanded="false" EnableHierarchyExpandAll="false" EnableGroupsExpandAll="true" HierarchyLoadMode="ServerOnDemand">
 
            <Columns>
                <telerik:GridBoundColumn DataField="Salesperson" HeaderText="Salesperson" Visible="false" SortExpression="Salesperson" UniqueName="Salesperson" FilterControlAltText="Filter Salesperson column"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name" UniqueName="Name" FilterControlAltText="Filter Name column"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="QtaPZ_Delta" HeaderText="QtaPZ_Delta" HeaderStyle-Width="200" SortExpression="QtaPZ_Delta" UniqueName="QtaPZ_Delta" FilterControlAltText="Filter QtaPZ_Delta column" DataType="System.Double" ReadOnly="True"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Qta_Delta" HeaderText="Qta_Delta" SortExpression="Qta_Delta" HeaderStyle-Width="200" UniqueName="Qta_Delta" FilterControlAltText="Filter Qta_Delta column" DataType="System.Double" ReadOnly="True"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Imponibile_Delta" HeaderText="Imponibile_Delta" HeaderStyle-Width="200" SortExpression="Imponibile_Delta" UniqueName="Imponibile_Delta" DataType="System.Double" FilterControlAltText="Filter Imponibile_Delta column" ReadOnly="True"></telerik:GridBoundColumn>
            </Columns>
            <NestedViewTemplate>
                <asp:Label ID="labelSalesperson" runat="server" Visible="false" Text='<%# Eval("Salesperson") %>' />
                <telerik:RadGrid runat="server" ID="radGridProducer" Culture="it-IT" GroupPanelPosition="Top" DataSourceID="SqlDataSource1" EnableViewState="false">
                    <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" AllowDragToGroup="True" Scrolling-UseStaticHeaders="true" Scrolling-AllowScroll="true"></ClientSettings>
 
                    <MasterTableView DataKeyNames="Salesperson,Producer" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" HierarchyLoadMode="ServerOnDemand">
 
                        <NestedViewTemplate>
                            <asp:Label runat="server" ID="labelProducer" Visible="false" Text='<%# Eval("Producer") %>' />
                            <telerik:RadGrid runat="server" ID="radGridCommodityCtg" CellSpacing="-1" Culture="it-IT" DataSourceID="SqlDataSource1" GridLines="Both" GroupPanelPosition="Top" EnableViewState="false">
 
                                <MasterTableView DataKeyNames="Salesperson,Producer,CommodityCtg" DataSourceID="SqlDataSource1" AutoGenerateColumns="False">
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="Salesperson" Visible="false" ReadOnly="True" HeaderText="Salesperson" SortExpression="Salesperson" UniqueName="Salesperson" FilterControlAltText="Filter Salesperson column"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Producer" Visible="false" ReadOnly="True" HeaderText="Producer" SortExpression="Producer" UniqueName="Producer" FilterControlAltText="Filter Producer column"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CommodityCtg" ReadOnly="True" HeaderText="CommodityCtg" SortExpression="CommodityCtg" UniqueName="CommodityCtg" FilterControlAltText="Filter CommodityCtg column"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="DefaultTargetQta" HeaderText="DefaultTargetQta" SortExpression="DefaultTargetQta" UniqueName="DefaultTargetQta" DataType="System.Double" FilterControlAltText="Filter DefaultTargetQta column"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="DefaultTargetImponibile" HeaderText="DefaultTargetImponibile" SortExpression="DefaultTargetImponibile" UniqueName="DefaultTargetImponibile" DataType="System.Double" FilterControlAltText="Filter DefaultTargetImponibile column"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="QtaPZ_Delta" HeaderText="QtaPZ_Delta" HeaderStyle-Width="200" SortExpression="QtaPZ_Delta" UniqueName="QtaPZ_Delta" FilterControlAltText="Filter QtaPZ_Delta column" DataType="System.Double" ReadOnly="True"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Qta_Delta" HeaderText="Qta_Delta" SortExpression="Qta_Delta" HeaderStyle-Width="200" UniqueName="Qta_Delta" FilterControlAltText="Filter Qta_Delta column" DataType="System.Double" ReadOnly="True"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="Imponibile_Delta" HeaderText="Imponibile_Delta" HeaderStyle-Width="200" SortExpression="Imponibile_Delta" UniqueName="Imponibile_Delta" DataType="System.Double" FilterControlAltText="Filter Imponibile_Delta column" ReadOnly="True"></telerik:GridBoundColumn>
                                    </Columns>
 
                                </MasterTableView>
                            </telerik:RadGrid>
                            <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString='<%$ ConnectionStrings:dalessioConnectionString %>'
                                SelectCommand="SELECT        STRT_VenditePerAgenteAnnoPrec.Salesperson, STRT_VenditePerAgenteAnnoPrec.Name, (STRT_VenditePerAgenteAnnoPrec.QtaPZ / 100)
                         * (100 + CASE WHEN STRT_SalespersonProducerTarget.DefaultTargetQta IS NOT NULL
                         THEN STRT_SalespersonProducerTarget.DefaultTargetQta ELSE STRT_SalespersonProducerCtgTarget.DefaultTargetQta END) - STRT_VenditePerAgenteAnnoCor.QtaPZ AS QtaPZ_Delta,
                         (STRT_VenditePerAgenteAnnoPrec.Qta / 100) * (100 + CASE WHEN STRT_SalespersonProducerTarget.DefaultTargetQta IS NOT NULL
                         THEN STRT_SalespersonProducerTarget.DefaultTargetQta ELSE STRT_SalespersonProducerCtgTarget.DefaultTargetQta END) - STRT_VenditePerAgenteAnnoCor.Qta AS Qta_Delta,
                         (STRT_VenditePerAgenteAnnoPrec.Qta / 100) * (100 + CASE WHEN STRT_SalespersonProducerTarget.DefaultTargetImponibile IS NOT NULL
                         THEN STRT_SalespersonProducerTarget.DefaultTargetImponibile ELSE STRT_SalespersonProducerCtgTarget.DefaultTargetImponibile END) - STRT_VenditePerAgenteAnnoCor.Imponibile AS Imponibile_Delta,
                         STRT_VenditePerAgenteAnnoCor.Producer, STRT_VenditePerAgenteAnnoPrec.Producer AS Expr1, STRT_SalespersonProducerTarget.DefaultTargetQta, STRT_SalespersonProducerTarget.DefaultTargetImponibile,
                         STRT_VenditePerAgenteAnnoCor.CommodityCtg, STRT_VenditePerAgenteAnnoPrec.CommodityCtg AS Expr2, STRT_VenditePerAgenteAnnoCor.Salesperson AS Expr3
                        FROM            STRT_VenditePerAgenteAnnoCor LEFT OUTER JOIN
                         STRT_SalespersonProducerCtgTarget ON STRT_VenditePerAgenteAnnoCor.Producer = STRT_SalespersonProducerCtgTarget.Producer AND
                         STRT_VenditePerAgenteAnnoCor.CommodityCtg = STRT_SalespersonProducerCtgTarget.CommodityCtg AND
                         STRT_VenditePerAgenteAnnoCor.Salesperson = STRT_SalespersonProducerCtgTarget.Salesperson RIGHT OUTER JOIN
                         STRT_VenditePerAgenteAnnoPrec ON STRT_VenditePerAgenteAnnoCor.Salesperson = STRT_VenditePerAgenteAnnoPrec.Salesperson AND
                         STRT_VenditePerAgenteAnnoCor.CommodityCtg = STRT_VenditePerAgenteAnnoPrec.CommodityCtg AND STRT_VenditePerAgenteAnnoCor.Producer = STRT_VenditePerAgenteAnnoPrec.Producer AND
                         STRT_SalespersonProducerCtgTarget.Salesperson = STRT_VenditePerAgenteAnnoPrec.Salesperson AND
                         STRT_SalespersonProducerCtgTarget.CommodityCtg = STRT_VenditePerAgenteAnnoPrec.CommodityCtg AND
                         STRT_SalespersonProducerCtgTarget.Producer = STRT_VenditePerAgenteAnnoPrec.Producer LEFT OUTER JOIN
                         STRT_SalespersonProducerTarget ON STRT_VenditePerAgenteAnnoCor.Producer = STRT_SalespersonProducerTarget.Producer AND
                         STRT_VenditePerAgenteAnnoCor.Salesperson = STRT_SalespersonProducerTarget.Salesperson AND STRT_VenditePerAgenteAnnoPrec.Salesperson = STRT_SalespersonProducerTarget.Salesperson AND
                         STRT_VenditePerAgenteAnnoPrec.Producer = STRT_SalespersonProducerTarget.Producer
                        WHERE ((STRT_VenditePerAgenteAnnoCor.[Producer] = @Producer OR STRT_VenditePerAgenteAnnoPrec.[Producer] = @Producer) AND (STRT_VenditePerAgenteAnnoPrec.[Salesperson] = @Salesperson OR STRT_VenditePerAgenteAnnoCor.[Salesperson] = @Salesperson))">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="labelSalesperson" PropertyName="Text" Name="Salesperson" Type="String"></asp:ControlParameter>
                                    <asp:ControlParameter ControlID="labelProducer" PropertyName="Text" Name="Producer" Type="String"></asp:ControlParameter>
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </NestedViewTemplate>
 
 
                        <Columns>
                            <telerik:GridBoundColumn DataField="Producer" ReadOnly="True" HeaderText="Producer" SortExpression="Producer" UniqueName="Producer" FilterControlAltText="Filter Producer column"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="DefaultTargetQta" HeaderText="DefaultTargetQta" HeaderStyle-Width="200" SortExpression="DefaultTargetQta" UniqueName="DefaultTargetQta" DataType="System.Double" FilterControlAltText="Filter DefaultTargetQta column"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="DefaultTargetImponibile" HeaderText="DefaultTargetImponibile" HeaderStyle-Width="200" SortExpression="DefaultTargetImponibile" UniqueName="DefaultTargetImponibile" DataType="System.Double" FilterControlAltText="Filter DefaultTargetImponibile column"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="QtaPZ_Delta" HeaderText="QtaPZ_Delta" HeaderStyle-Width="200" SortExpression="QtaPZ_Delta" UniqueName="QtaPZ_Delta" DataType="System.Double" FilterControlAltText="Filter QtaPZ_Delta column"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Qta_Delta" HeaderText="Qta_Delta" HeaderStyle-Width="200" SortExpression="Qta_Delta" UniqueName="Qta_Delta" DataType="System.Double" FilterControlAltText="Filter Qta_Delta column"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Imponibile_Delta" HeaderText="Imponibile_Delta" HeaderStyle-Width="200" SortExpression="Imponibile_Delta" UniqueName="Imponibile_Delta" DataType="System.Double" FilterControlAltText="Filter Imponibile_Delta column"></telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
                <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString='<%$ ConnectionStrings:dalessioConnectionString %>'
                    SelectCommand="
                    SELECT        STRT_VenditePerAgenteAnnoPrec.Salesperson, STRT_VenditePerAgenteAnnoPrec.Name, SUM((STRT_VenditePerAgenteAnnoPrec.QtaPZ / 100)
                         * (100 + CASE WHEN STRT_SalespersonProducerTarget.DefaultTargetQta IS NOT NULL
                         THEN STRT_SalespersonProducerTarget.DefaultTargetQta ELSE STRT_SalespersonProducerCtgTarget.DefaultTargetQta END) - STRT_VenditePerAgenteAnnoCor.QtaPZ) AS QtaPZ_Delta,
                         SUM((STRT_VenditePerAgenteAnnoPrec.Qta / 100) * (100 + CASE WHEN STRT_SalespersonProducerTarget.DefaultTargetQta IS NOT NULL
                         THEN STRT_SalespersonProducerTarget.DefaultTargetQta ELSE STRT_SalespersonProducerCtgTarget.DefaultTargetQta END) - STRT_VenditePerAgenteAnnoCor.Qta) AS Qta_Delta,
                         SUM((STRT_VenditePerAgenteAnnoPrec.Qta / 100) * (100 + CASE WHEN STRT_SalespersonProducerTarget.DefaultTargetImponibile IS NOT NULL
                         THEN STRT_SalespersonProducerTarget.DefaultTargetImponibile ELSE STRT_SalespersonProducerCtgTarget.DefaultTargetImponibile END) - STRT_VenditePerAgenteAnnoCor.Imponibile) AS Imponibile_Delta,
                         STRT_VenditePerAgenteAnnoCor.Producer, STRT_VenditePerAgenteAnnoPrec.Producer AS Expr1, STRT_SalespersonProducerTarget.DefaultTargetQta,
                         STRT_SalespersonProducerTarget.DefaultTargetImponibile
FROM            STRT_VenditePerAgenteAnnoCor LEFT OUTER JOIN
                         STRT_SalespersonProducerCtgTarget ON STRT_VenditePerAgenteAnnoCor.Producer = STRT_SalespersonProducerCtgTarget.Producer AND
                         STRT_VenditePerAgenteAnnoCor.CommodityCtg = STRT_SalespersonProducerCtgTarget.CommodityCtg AND
                         STRT_VenditePerAgenteAnnoCor.Salesperson = STRT_SalespersonProducerCtgTarget.Salesperson RIGHT OUTER JOIN
                         STRT_VenditePerAgenteAnnoPrec ON STRT_VenditePerAgenteAnnoCor.Salesperson = STRT_VenditePerAgenteAnnoPrec.Salesperson AND
                         STRT_VenditePerAgenteAnnoCor.CommodityCtg = STRT_VenditePerAgenteAnnoPrec.CommodityCtg AND STRT_VenditePerAgenteAnnoCor.Producer = STRT_VenditePerAgenteAnnoPrec.Producer AND
                         STRT_SalespersonProducerCtgTarget.Salesperson = STRT_VenditePerAgenteAnnoPrec.Salesperson AND
                         STRT_SalespersonProducerCtgTarget.CommodityCtg = STRT_VenditePerAgenteAnnoPrec.CommodityCtg AND
                         STRT_SalespersonProducerCtgTarget.Producer = STRT_VenditePerAgenteAnnoPrec.Producer LEFT OUTER JOIN
                         STRT_SalespersonProducerTarget ON STRT_VenditePerAgenteAnnoCor.Producer = STRT_SalespersonProducerTarget.Producer AND
                         STRT_VenditePerAgenteAnnoCor.Salesperson = STRT_SalespersonProducerTarget.Salesperson AND STRT_VenditePerAgenteAnnoPrec.Salesperson = STRT_SalespersonProducerTarget.Salesperson AND
                         STRT_VenditePerAgenteAnnoPrec.Producer = STRT_SalespersonProducerTarget.Producer
                      WHERE (STRT_SalespersonProducerTarget.[Salesperson] = @Salesperson)
GROUP BY STRT_VenditePerAgenteAnnoPrec.Salesperson, STRT_VenditePerAgenteAnnoPrec.Name, STRT_VenditePerAgenteAnnoCor.Producer, STRT_VenditePerAgenteAnnoPrec.Producer,
                         STRT_SalespersonProducerTarget.DefaultTargetQta, STRT_SalespersonProducerTarget.DefaultTargetImponibile">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="labelSalesperson" PropertyName="Text" Name="Salesperson" Type="String"></asp:ControlParameter>
                    </SelectParameters>
                </asp:SqlDataSource>
            </NestedViewTemplate>
        </MasterTableView>
    </telerik:RadGrid>
 
    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString='<%$ ConnectionStrings:dalessioConnectionString %>'
        SelectCommand="SELECT        STRT_VenditePerAgenteAnnoPrec.Salesperson, STRT_VenditePerAgenteAnnoPrec.Name, SUM((STRT_VenditePerAgenteAnnoPrec.QtaPZ / 100)
                         * (100 + CASE WHEN STRT_SalespersonProducerTarget.DefaultTargetQta IS NOT NULL
                         THEN STRT_SalespersonProducerTarget.DefaultTargetQta ELSE STRT_SalespersonProducerCtgTarget.DefaultTargetQta END) - STRT_VenditePerAgenteAnnoCor.QtaPZ) AS QtaPZ_Delta,
                         SUM((STRT_VenditePerAgenteAnnoPrec.Qta / 100) * (100 + CASE WHEN STRT_SalespersonProducerTarget.DefaultTargetQta IS NOT NULL
                         THEN STRT_SalespersonProducerTarget.DefaultTargetQta ELSE STRT_SalespersonProducerCtgTarget.DefaultTargetQta END) - STRT_VenditePerAgenteAnnoCor.Qta) AS Qta_Delta,
                         SUM((STRT_VenditePerAgenteAnnoPrec.Qta / 100) * (100 + CASE WHEN STRT_SalespersonProducerTarget.DefaultTargetImponibile IS NOT NULL
                         THEN STRT_SalespersonProducerTarget.DefaultTargetImponibile ELSE STRT_SalespersonProducerCtgTarget.DefaultTargetImponibile END) - STRT_VenditePerAgenteAnnoCor.Imponibile)
                         AS Imponibile_Delta
                         FROM STRT_VenditePerAgenteAnnoPrec FULL OUTER JOIN
                         STRT_SalespersonProducerCtgTarget ON STRT_VenditePerAgenteAnnoPrec.Salesperson = STRT_SalespersonProducerCtgTarget.Salesperson AND
                         STRT_VenditePerAgenteAnnoPrec.CommodityCtg = STRT_SalespersonProducerCtgTarget.CommodityCtg AND
                         STRT_VenditePerAgenteAnnoPrec.Producer = STRT_SalespersonProducerCtgTarget.Producer FULL OUTER JOIN
                         STRT_VenditePerAgenteAnnoCor ON STRT_SalespersonProducerCtgTarget.Producer = STRT_VenditePerAgenteAnnoCor.Producer AND
                         STRT_SalespersonProducerCtgTarget.CommodityCtg = STRT_VenditePerAgenteAnnoCor.CommodityCtg AND
                         STRT_SalespersonProducerCtgTarget.Salesperson = STRT_VenditePerAgenteAnnoCor.Salesperson AND STRT_VenditePerAgenteAnnoPrec.Salesperson = STRT_VenditePerAgenteAnnoCor.Salesperson AND
                         STRT_VenditePerAgenteAnnoPrec.CommodityCtg = STRT_VenditePerAgenteAnnoCor.CommodityCtg AND STRT_VenditePerAgenteAnnoPrec.Producer = STRT_VenditePerAgenteAnnoCor.Producer FULL OUTER JOIN
                         STRT_SalespersonProducerTarget ON STRT_VenditePerAgenteAnnoCor.Producer = STRT_SalespersonProducerTarget.Producer AND
                         STRT_VenditePerAgenteAnnoCor.Salesperson = STRT_SalespersonProducerTarget.Salesperson AND STRT_VenditePerAgenteAnnoPrec.Salesperson = STRT_SalespersonProducerTarget.Salesperson AND
                         STRT_VenditePerAgenteAnnoPrec.Producer = STRT_SalespersonProducerTarget.Producer
                        GROUP BY STRT_VenditePerAgenteAnnoPrec.Salesperson, STRT_VenditePerAgenteAnnoPrec.Name"></asp:SqlDataSource>
 
 
</asp:Content>

1 Answer, 1 is accepted

Sort by
0
Start Informatica c.a.
Top achievements
Rank 1
answered on 24 Feb 2017, 05:53 PM
I forgot to mention that top level query returns 10 rows, second level query returns an average of 60 rows and third level an average of 4 rows so the total is approximately 10*60*4 rows...
Tags
Grid
Asked by
Start Informatica c.a.
Top achievements
Rank 1
Answers by
Start Informatica c.a.
Top achievements
Rank 1
Share this question
or