Problem with partial rendering

2 posts, 0 answers
  1. John
    John avatar
    1 posts
    Member since:
    Jun 2012

    Posted 26 Jun 2012 Link to this post

    Hello,

    I have a RadGrid displaying data about orders (id, customer's name, firstname, etc) where each row is expandable. When a row is expanded, additional information contained in an ascx component is being shown. My problem is that the whole grid is actually fully reloaded each time a row is being expanded! (I noticed this behavior by displaying current datetime inside the component).

    Am I missing some obvious settings?

    aspx:
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" EnablePartialRendering="true" />
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="griOrders">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="griOrders" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" EnableViewState="true" />
        <telerik:RadGrid ID="griOrders" runat="server" AutoGenerateColumns="False" AllowSorting="True"
            AllowMultiRowSelection="False" AllowPaging="True" PageSize="20" GridLines="None"
            AllowFilteringByColumn="True" 
            SortingSettings-SortedAscToolTip="Tri croissant" SortingSettings-SortedDescToolTip="Tri décroissant"
            OnSortCommand="griOrders_SortCommand" OnItemCommand="griOrders_ItemCommand"
            OnPageIndexChanged="griOrders_PageIndexChanged" OnNeedDataSource="griOrders_NeedDataSource">
            <PagerStyle Mode="NumericPages"></PagerStyle>
            <MasterTableView DataKeyNames="ID" AllowMultiColumnSorting="True" AllowNaturalSort="true"
                GroupLoadMode="Server">
                <NestedViewTemplate>
                    <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">
                            <uc:test runat ="server" />
                    </asp:Panel>
                </NestedViewTemplate>
                <Columns>
                    <telerik:GridBoundColumn SortExpression="ID" HeaderText="ID" HeaderButtonType="TextButton"
                        DataField="ID" UniqueName="ID" DataType="System.String" ItemStyle-Width="70px"
                        FilterControlWidth="50px">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Date" HeaderText="Date" HeaderButtonType="TextButton"
                        DataField="Date" UniqueName="Date" DataType="System.DateTime" ItemStyle-Width="80px"
                        FilterControlWidth="60px">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Heure" HeaderText="Heure" HeaderButtonType="TextButton"
                        DataField="Heure" UniqueName="Heure" DataType="System.String" ItemStyle-Width="70px"
                        FilterControlWidth="50px">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="TTC" HeaderText="TTC" HeaderButtonType="TextButton"
                        DataField="TTC" UniqueName="TTC" DataType="System.Decimal" ItemStyle-HorizontalAlign="Right"
                        ItemStyle-Width="70px" FilterControlWidth="50px">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Nom Prénom" HeaderText="Nom Prénom" HeaderButtonType="TextButton"
                        DataField="Nom Prénom" UniqueName="NomPrénom" DataType="System.String" FilterControlWidth="150px">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

    Code Behind

    protected void griOrders_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item is GridDataItem)
            {
                ((GridDataItem)e.Item).ChildItem.FindControl("InnerContainer").Visible = !e.Item.Expanded;
            }
        }

    Thanks for your help!
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 29 Jun 2012 Link to this post

    Hi John,

    Actually the described behaviour is expected in this case. In order to avoid this behaviour I would suggest you to set the HierarchyLoadMode for the RadGrid to "client" for more information on this matter see the help topic below:
    http://www.telerik.com/help/aspnet-ajax/grid-hierarchy-load-modes.html

    Kind regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top