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

DetailTable paging and expanding

4 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yaroslav
Top achievements
Rank 1
Yaroslav asked on 07 Oct 2011, 01:20 PM
Hello. I'm using RadGrid with detail table and paging. The problem: all detail tables have the same number of pages and items in pager:
<telerik:RadGrid ID="radGridFolders" runat="server" AutoGenerateColumns="False" AllowSorting="True"
    GridLines="None" ShowGroupPanel="False" OnDetailTableDataBind="RadGridFoldersDetailTableDataBind"
    OnNeedDataSource="RadGridFoldersNeedDataSource" OnItemCreated="RadGridFoldersItemCreated"
    AllowPaging="True" PageSize="5">
    <MasterTableView DataKeyNames="EventFolderId">
        <DetailTables>
            <telerik:GridTableView AutoGenerateColumns="false" DataKeyNames="EventId" Width="100%">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="EventFolderId" MasterKeyField="EventFolderId" />
                </ParentTableRelation>
                <Columns>
                    <telerik:GridBoundColumn SortExpression="EventName" HeaderText="Event Name" DataField="EventName"
                        UniqueName="EventName">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn UniqueName="Action" HeaderText="Action" HeaderStyle-HorizontalAlign="Right">
                        <ItemTemplate>
                            <ul class="actions">
                                <li>
                                    <telerik:RadButton ID="radBtnEventEdit" runat="server" Text="Edit" ButtonType="LinkButton"
                                        ForeColor="#0067be" CausesValidation="False" BorderStyle="None">
                                        <Icon PrimaryIconUrl="../images/img_rename.gif" />
                                    </telerik:RadButton>
                                </li>
                                <li>
                                    <telerik:RadButton ID="radBtnEventDuplicate" runat="server" Text="Duplicate" ButtonType="LinkButton"
                                        ForeColor="#0067be" CausesValidation="False" BorderStyle="None">
                                        <Icon PrimaryIconUrl="../images/img_duplicate.gif" />
                                    </telerik:RadButton>
                                </li>
                                <li>
                                    <telerik:RadButton ID="radBtnEventRemove" runat="server" Text="Remove" ButtonType="LinkButton"
                                        ForeColor="#0067be" CausesValidation="False" BorderStyle="None">
                                        <Icon PrimaryIconUrl="../images/img_remove.gif" />
                                    </telerik:RadButton>
                                </li>
                                <li>
                                    <telerik:RadButton ID="radBtnEventRegional" runat="server" Text="Regional" ButtonType="LinkButton"
                                        ForeColor="#0067be" CausesValidation="False" BorderStyle="None">
                                        <Icon PrimaryIconUrl="../images/img_regional.gif" />
                                    </telerik:RadButton>
                                </li>
                                <li>
                                    <telerik:RadButton ID="radBtnEventView" runat="server" Text="View" ButtonType="LinkButton"
                                        ForeColor="#0067be" CausesValidation="False" BorderStyle="None">
                                        <Icon PrimaryIconUrl="../images/img_view.gif" />
                                    </telerik:RadButton>
                                </li>
                            </ul>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
        <Columns>
            <telerik:GridTemplateColumn HeaderText="Event Folder" DataField="EventFolder" UniqueName="EventFolder">
                <ItemTemplate>
                    <table cellspacing="0" width="100%">
                        <tr>
                            <td style="width: 25%">
                                <img src="../images/img_folder_closed.gif" border="0" alt="<%# Eval("EventFolder") %>" />
                            </td>
                            <td style="width: 75%">
                                <%# Eval("EventFolder")%>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>
As you can see on screenshot: first detaible is correct: there are 8 records in it, 2 pages. but next table contains only one record, and next is empty. And pagers for both of them show 8 records in 2 pages.
And one more question: is it possible to collapse one row when another is expanding?

4 Answers, 1 is accepted

Sort by
0
Accepted
Iana Tsolova
Telerik team
answered on 10 Oct 2011, 03:57 AM
Hi Yaroslav,

Please remove the ParentTableRelations, they should be used only if the hierarchical grid is bound declaratively. Then make sure you are assigning the proper data source for each of the nexted view in the DetailTableDataBind event. For more information, check the below resources:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/detailtabledatabind/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/grid-hierarchical-data-binding-using-detailtabledatabind.html

Greetings,
Iana Tsolova
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
Yaroslav
Top achievements
Rank 1
answered on 10 Oct 2011, 07:03 AM
Thanks a lot!
<ParentTableRelation>
          <telerik:GridRelationFields DetailKeyField="EventFolderId" MasterKeyField="EventFolderId" />
</ParentTableRelation>
It was only mistake - event DetailTableDataBind was correct.
For expanding/collapsing I found info here
http://www.telerik.com/help/aspnet-ajax/grid-single-expand-in-hierarchical-grid.html
Is it only way?
0
Accepted
Iana Tsolova
Telerik team
answered on 10 Oct 2011, 03:03 PM
Hello Yaroslav,

Yes, you should use the code in the ItemCommand event handler to implement single item expand mode.

Greetings,
Iana Tsolova
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
Yaroslav
Top achievements
Rank 1
answered on 11 Oct 2011, 04:43 PM
Thanks
Tags
Grid
Asked by
Yaroslav
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Yaroslav
Top achievements
Rank 1
Share this question
or