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

CancelAll command collapses the currently open DetailsTable

1 Answer 37 Views
This is a migrated thread and some comments may be shown as answers.
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

<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">
    <telerik:GridRelationFields DetailKeyField="PersonId" MasterKeyField="PersonId" />          
<HeaderStyle Font-Bold="true" />
    <table width="100%">
        <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>
    <telerik:GridTemplateColumn UniqueName="SiteAccessConditionName" HeaderText="Access Condition Name" HeaderStyle-Width="200px" HeaderStyle-HorizontalAlign="Center">

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
Telerik team
answered on 17 Sep 2012, 10:17 AM

 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.

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.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question