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

Radgrid custom paging with hierarchy

4 Answers 206 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mehmet Tirgil
Top achievements
Rank 1
Mehmet Tirgil asked on 14 Nov 2011, 04:17 PM
Hi,
I try to use custom paging in radgrid with hierarcy. If i use just paging everthing works fine. But if i use custum paging, the main table works fine with virtualitemcount property, but can not paging in sub tables.

This is my grid properties.
 <telerik:RadGrid ID="GvwItems" runat="server" ClientIDMode="AutoID" AutoGenerateColumns="False" GridLines="None" EnableLinqExpressions="False" Skin="Office2007" AllowPaging="True" AllowCustomPaging="true" PageSize="25" AllowSorting="True">
 
This is NeedDataSource Event
If IsExpanded = True OrElse e.IsFromDetailTable = True Then
GvwItems.VirtualItemCount = MyTable.Rows(0).Item("RCount")
Else
GvwItems.MasterTableView.VirtualItemCount = MyTable.Rows(0).Item("RCount")
End If


4 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 17 Nov 2011, 05:28 PM
Hello Mehmet,

Thank you for contacting us.

Attached is a small sample that demonstrates how to use custom paging in a hierarchical grid and how to correctly set the VirtualItemCount property.

Do let us know how it goes.

Best wishes,
Tsvetoslav
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
0
Mehmet Tirgil
Top achievements
Rank 1
answered on 28 Nov 2011, 11:33 AM
Hi,
Thanks for reply. But i do not use detailtable. I use SelfHierarchySetting. My grid properties like below.

 <telerik:RadGrid ID="GvwItems" runat="server" ClientIDMode="AutoID" AutoGenerateColumns="False" GridLines="None" EnableLinqExpressions="False" Skin="Office2007" AllowPaging="True" AllowCustomPaging="true" PageSize="25" AllowSorting="True">
                <ClientSettings>
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="False" />
                    <ClientEvents OnRowDblClick="RowDblClick" />
                </ClientSettings>
                <MasterTableView DataKeyNames="PageId,ContentId,ContentLevel,ParentContentLevel,HasChild" AllowFilteringByColumn="True" AllowCustomPaging="true" HierarchyLoadMode="ServerOnDemand">
                    <ExpandCollapseColumn></ExpandCollapseColumn>
                    <SelfHierarchySettings ParentKeyName="ParentContentLevel" KeyName="ContentLevel"></SelfHierarchySettings>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ListOrder" HeaderText="ListOrder"
                            UniqueName="ListOrder" AllowFiltering="false"
                            DataType="System.Int32">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContentHeader" HeaderText="ContentHeader"
                            UniqueName="ContentHeader" AutoPostBackOnFilter="True"
                            ShowFilterIcon="False">
                        </telerik:GridBoundColumn>                        
                    </Columns>                   
                </MasterTableView>               
            </telerik:RadGrid>       
0
Mehmet Tirgil
Top achievements
Rank 1
answered on 28 Nov 2011, 02:50 PM
Hi, I understood that, i can use detailtables with selfhierarchysettings. I used it. Now it look likes below, and custom paging is work now. But there are two problems. One is DetailTableDatabind fire two times, i do not understand why. I change my code in detailtabledatabind like that

If FirstTime = True then
bla bla...
.datasource = ...
FirstTime = false
End If

And the second problem is; NeeddataSource event fire when detailtabledatabind fires, so grid is recreated and add below of detailtable. So i make change my code in needdatadource like that

If IsExpanded = False andalso e.IsFromDetailTable = False Then
bla bla...
grid.datasource = ...
End If

This is my new grid codes
<telerik:RadGrid ID="GvwItems" runat="server" ClientIDMode="AutoID" AutoGenerateColumns="False" GridLines="None" EnableLinqExpressions="False" Skin="Office2007" AllowPaging="True" AllowCustomPaging="true" PageSize="25" AllowSorting="True">
                <ClientSettings>
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="False" />
                    <ClientEvents OnRowDblClick="RowDblClick" />
                </ClientSettings>
                <MasterTableView DataKeyNames="PageId,ContentId,ContentLevel,ParentContentLevel,HasChild" AllowFilteringByColumn="True" AllowCustomPaging="true" HierarchyLoadMode="ServerOnDemand">
                    <ExpandCollapseColumn></ExpandCollapseColumn>
                    <SelfHierarchySettings ParentKeyName="ParentContentLevel" KeyName="ContentLevel"></SelfHierarchySettings>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ListOrder" HeaderText="ListOrder"
                            UniqueName="ListOrder" AllowFiltering="false"
                            DataType="System.Int32">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContentHeader" HeaderText="ContentHeader"
                            UniqueName="ContentHeader" AutoPostBackOnFilter="True"
                            ShowFilterIcon="False">
                        </telerik:GridBoundColumn>                       
                    </Columns>
                    <DetailTables>
                        <telerik:GridTableView AllowPaging="true" AllowCustomPaging="true">
                            <Columns>
                                <telerik:GridBoundColumn DataField="ListOrder" HeaderText="ListOrder"
                                    UniqueName="ListOrder" AllowFiltering="false"
                                    DataType="System.Int32">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ContentHeader" HeaderText="ContentHeader"
                                    UniqueName="ContentHeader" AutoPostBackOnFilter="True"
                                    ShowFilterIcon="False">
                                </telerik:GridBoundColumn>                               
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>                
                </MasterTableView>               
            </telerik:RadGrid> 

I found another problem. If I change pagesize,  e.IsfromDetailTable is false when needdatasource event fires and detailtabledatabind does not fire. ???
0
Tsvetoslav
Telerik team
answered on 30 Nov 2011, 05:24 PM
Hi Mehmet,

Please, open up a formal support ticket and send your files - your mark-up snippets do not provide enough information to determine the cause of the problem.

Regards, Tsvetoslav
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
Tags
General Discussions
Asked by
Mehmet Tirgil
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Mehmet Tirgil
Top achievements
Rank 1
Share this question
or