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

CancelAll command collapses the currently open DetailsTable

1 Answer 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Glenn
Top achievements
Rank 1
Glenn asked on 12 Sep 2012, 07:43 PM

Below is a portion of my grid, which uses a DetailTable with its own CommandItemTemplate

<DetailTables>       
<telerik:GridTableView Name="PersonConditionGrid" runat="server" DataKeyNames="PersonConditionId" Caption="Conditions linked with this Person"
    DataSourceID="PersonConditionViewDataSrcId" TableLayout="Auto" Width="580px"
    AutoGenerateColumns="false" CommandItemDisplay="Top" ShowFooter="true"  FooterStyle-BorderStyle="Solid" FooterStyle-BorderWidth="2pt">
<ParentTableRelation>
    <telerik:GridRelationFields DetailKeyField="PersonId" MasterKeyField="PersonId" />          
</ParentTableRelation>
<HeaderStyle Font-Bold="true" />
<CommandItemTemplate>
    <table width="100%">
    <tr>
        <td align="left">
            <asp:LinkButton ID="btnAddNew" runat="server" CommandName="InitInsert"><asp:Image ID="imgAddNew" runat="server" ImageUrl="~/Images/button-New-24.gif" /> Add New Condition</asp:LinkButton>
            <asp:LinkButton ID="btnSaveNew" runat="server" CommandName="PerformInsert" ValidationGroup="EntryClass_VG"><asp:Image ID="imgSaveNew" runat="server" ImageUrl="~/Images/button-Save-24.gif" /> Save Condition</asp:LinkButton>
            <asp:LinkButton ID="btnEdit" runat="server" CommandName="EditSelected"><asp:Image ID="imgEdit" runat="server" ImageUrl="~/Images/button-Edit-24.gif" /> Take Action on Condition</asp:LinkButton>
            <asp:LinkButton ID="btnSaveEdit" runat="server" CommandName="UpdateEdited" ValidationGroup="EntryClass_VG"><asp:Image ID="imgSaveEdit" runat="server" ImageUrl="~/Images/button-Save-24.gif" /> Save Condition</asp:LinkButton>
            <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" CausesValidation="false"><asp:Image ID="imgCancel" runat="server" ImageUrl="~/Images/button-Cancel-24.gif" /> Cancel Edit</asp:LinkButton>
            <asp:LinkButton ID="btnDelete" runat="server" CommandName="DeleteSelected" OnClientClick="return confirm('Are you sure you want to delete the selected record?');"><asp:Image ID="imgDelete" runat="server" ImageUrl="~/Images/button-Del-24.gif" /> Delete Condition</asp:LinkButton>
        </td>
    </tr>
    </table>
</CommandItemTemplate>
<Columns>
    <telerik:GridTemplateColumn UniqueName="SiteAccessConditionName" HeaderText="Access Condition Name" HeaderStyle-Width="200px" HeaderStyle-HorizontalAlign="Center">
    <ItemTemplate>

After a Save operation, the detailTable remains open, with the new item displayed in the grid (as expected).

After a Cancel or Delete operation, the DetailsTable collapses and the user has to expand the item again.

Is there some way to prevent the DetailTable from collapsing after the Cancel or Delete operation?

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin
Telerik team
answered on 17 Sep 2012, 10:17 AM
Hello,

 When you use a custom command you have to persist the expanded index of the items in the hierarchy and set it again in the PreRender event of the page. You can traverse the GridNestedViewItems and check their Expanded property then after a Cancel or Delete operation you can set this property to true for the respective items.

Regards,
Marin
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
Grid
Asked by
Glenn
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or