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

Self Hierarchy Paging Problem

4 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
digitall
Top achievements
Rank 1
digitall asked on 05 Mar 2009, 08:57 PM
I am using the RADGrid with a self-referencing hierarchy. The markup for this is (columns omitted):

    <telerik:RadGrid ID="RadGrid1" runat="server" PageSize="50" AutoGenerateColumns="False" GridLines="None" Skin="Vista" ShowHeader="true" CommandItemStyle-Height="30px" Width="100%" HorizontalAlign="Center" AllowPaging="true" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCreated="RadGrid1_ItemCreated"
        <MasterTableView HierarchyDefaultExpanded="false" HierarchyLoadMode="Client" EnableNoRecordsTemplate="true" DataKeyNames="NETT_IS_ID,NETT_ID" Width="100%"
            <SelfHierarchySettings KeyName="ID" ParentKeyName="IS_ID" />             
            <Columns>                 
 
            </Columns> 
            <EditFormSettings> 
                <PopUpSettings ScrollBars="None"></PopUpSettings> 
            </EditFormSettings> 
            <PagerTemplate> 
                    <table border="0" cellpadding="0" cellspacing="0" style="height: 20px" align="center"
                        <tr> 
                            <td width="100px"
                                <asp:LinkButton ID="LinkButton1" CommandName="Page" CausesValidation="false" CommandArgument="First" runat="server" style="text-decoration: none;"><img src="_assets/images/first.gif" alt="" style="vertical-align:middle; border: none; "/> <span class="pager">First</span></asp:LinkButton> 
                            </td> 
                            <td width="100px"
                                <asp:LinkButton ID="LinkButton5" CommandName="Page" CausesValidation="false" CommandArgument="Prev" runat="server" style="text-decoration: none;"><img src="_assets/images/arrow.gif" alt="" style="vertical-align:middle; border: none;" /> <span class="pager">Prev</span></asp:LinkButton> 
                            </td> 
                            <td align="center" width="100px"
                                <asp:LinkButton ID="LinkButton6" CommandName="RebindGrid" CausesValidation="false" runat="server" style="text-decoration: none;"><img src="_assets/images/refresh.gif" alt="" style="margin-right: 2px; vertical-align: middle; border: none;" /> <span class="pager">Refresh</span></asp:LinkButton> 
                            </td>                             
                            <td align="right" width="100px"
                                <asp:LinkButton ID="LinkButton3" CommandName="Page" CausesValidation="false" CommandArgument="Next" runat="server" style="text-decoration: none;"><span class="pager">Next</span> <img src="_assets/images/arrowRight.gif" style="vertical-align:middle; border: none;" alt="" /></asp:LinkButton> 
                            </td> 
                            <td align="right" width="100px"
                                <asp:LinkButton ID="LinkButton2" CommandName="Page" CausesValidation="false" CommandArgument="Last" runat="server" style="text-decoration: none;"><span class="pager">Last</span> <img src="_assets/images/last.gif" style="vertical-align:middle; border: none;" alt="" /></asp:LinkButton> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td colspan="5" align="center"
                                Page <%# (int)DataBinder.Eval(Container, "Paging.CurrentPageIndex") + 1 %> of <%# DataBinder.Eval(Container, "Paging.PageCount")%>, items from <%# (int)DataBinder.Eval(Container, "Paging.FirstIndexInPage") + 1 %> to <%# (int)DataBinder.Eval(Container, "Paging.LastIndexInPage") + 1 %> of <%# DataBinder.Eval(Container, "Paging.DataSourceCount")%>
                            </td> 
                        </tr> 
                    </table> 
                </PagerTemplate> 
        </MasterTableView> 
        <PagerStyle Mode="Advanced" /> 
    </telerik:RadGrid> 

The total record count in the database is 150. If I set the page size to 50, when I get to the third page the child records don't show (nor do the arrows indicating child records are present), however pages 1 and 2 worked fine. If I change the page size to 100 or higher the records with issues originally on page 3+ work flawlessly, but then I get the annoying "This script is taking a long time to run, do you wish to cancel?" error message from IE. It is only when the records get to the third page or more that their correlating child entries stop displaying.

The grid is being bound in the code-behind (Oracle is the provider) using the NeedDataSource event handler. Whenever that event is fired the grid's data source is set to a data table containing the entries (which is retrieved every time that event fires - all records returned according to the stored procedure).

Any thoughts on why pages 3+ would break, but 1 or 2 function fine no matter the page count?

4 Answers, 1 is accepted

Sort by
0
digitall
Top achievements
Rank 1
answered on 07 Mar 2009, 10:39 PM
Any guesses?
0
Accepted
Georgi Krustev
Telerik team
answered on 10 Mar 2009, 12:17 PM
Hi Scott,

This is a known issue with .NET 3.5 build of RadGrid for ASP.NET AJAX  - we will do our best to address it in one of the next versions of the product.

Please set the EnableLinqExpressions to "false" as a temporary solution. This should fix this abnormality. I also updated your Telerik points for the report.

Kind regards,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
zxp
Top achievements
Rank 1
answered on 28 Feb 2011, 09:42 AM
I have the same problem with version 2010.3.1215.40. 

I have tried set EnableLinqExpressions=false, but that makes thing worse. All child items are displayed in as a root item, hence there are lots of duplicate items.

If I set the pageSize big enough to show all the items in one page, then everything works fine.
Can anyone help me on this? Thanks very very much!
0
Tsvetoslav
Telerik team
answered on 02 Mar 2011, 10:00 AM
Hello Scott,

When disabling linq expressions, your initial filter condition should change so that not all child items but only the root one be displayed. Take a look at our online example, how it is done in the on Page_Load event:
public void Page_Load(object sender, EventArgs e)
{
    if (Assembly.GetAssembly(typeof(ScriptManager)).FullName.IndexOf("3.5") != -1 || Assembly.GetAssembly(typeof(ScriptManager)).FullName.IndexOf("4.0") != -1)
    {
        RadGrid1.MasterTableView.FilterExpression = @"it[""ReportsTo""] = Convert.DBNull";
    }
    else
    {
        RadGrid1.MasterTableView.FilterExpression = "ReportsTo IS NULL";
    }
}

The else branch of the condition is the one you want to implement, of course, reworking it accordingly for the field you have.

Hope it helps.

Greetings,
Tsvetoslav
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Grid
Asked by
digitall
Top achievements
Rank 1
Answers by
digitall
Top achievements
Rank 1
Georgi Krustev
Telerik team
zxp
Top achievements
Rank 1
Tsvetoslav
Telerik team
Share this question
or