Expand original group from return of radwindow

3 posts, 1 answers
  1. Patrick
    Patrick avatar
    19 posts
    Member since:
    Jun 2013

    Posted 01 Nov Link to this post

    I have a radgrid which is set to "GroupsDefaultExpanded=False" in the MasterTableView.   When a user expands one of the groups they can edit a row within that group which opens a radwindow so they can make changes.  Once they close the RadWindow and it returns to the original page, all of the groups are back to being collapsed, but the user wants the original group they were working on to remain expanded.  I am using vb.net and aspx pages.  How can I expand the original group when returning from the RadWindow?

    RadWindow Code:

    <script type="text/javascript">
        function RefreshData(oWnd, eventArgs) {
            <%=Page.ClientScript.GetPostBackEventReference(btnRefresh, "")%>
        }
    </script>
    <telerik:RadWindow ID="rwEditAttendance" Behaviors="Close" VisibleStatusbar="false" AutoSize="true" EnableViewState="false" runat="server" Modal="true" VisibleOnPageLoad="false" OnClientClose="RefreshData" />
    <asp:Button runat="Server" ID="btnRefresh" style="display:none; width:0px; height:0px;" />

     

    Table code:

    <telerik:RadGrid ID="rgAttendanceManager" runat="server" AllowFilteringByColumn="False" AllowSorting="True" ShowGroupPanel="False" AutoGenerateColumns="False" BorderColor="Silver">
        <MasterTableView
            GridLines="None" Width="100%"
            NoDetailRecordsText="No data matching criteria specified"
            NoMasterRecordsText="No data matching criteria specified"
            EnableNoRecordsTemplate="true"
            DataKeyNames="EmployeeId,EventDate,TimecardCommentId,TCUniqueId,Modified"
            ShowGroupFooter="true" 
            GroupsDefaultExpanded="false"
            >
            <GroupByExpressions >
                <telerik:GridGroupByExpression >
                    <SelectFields >
                        <telerik:GridGroupByField FieldName="EmployeeName" HeaderValueSeparator=""  HeaderText=" "  />
                    </SelectFields>
                    <GroupByFields >
                        <telerik:GridGroupByField FieldName="EmployeeName"  />
                    </GroupByFields>
                </telerik:GridGroupByExpression>
            </GroupByExpressions>
     
            <Columns>
                <telerik:GridButtonColumn UniqueName="EditComment" Text="Edit Comment" ButtonType="LinkButton" CommandName="EditComment" />
                <telerik:GridDateTimeColumn DataField="EventDate" HeaderText ="Event Date"  SortExpression="EventDate" HeaderStyle-Wrap="false" DataFormatString="{0:d}"/>
                 
                <telerik:GridDateTimeColumn DataField="HistoricalDate" HeaderText ="Historical Date"  SortExpression="HistoricalDate" HeaderStyle-Wrap="false" DataFormatString="{0:d}"/>
                <telerik:GridBoundColumn DataField="PaycodeName" HeaderText="Paycode Name" SortExpression="PaycodeName" ItemStyle-Wrap="false" />
                <telerik:GridBoundColumn DataField="CommentText" HeaderText="Comment Text" SortExpression="CommentText" ItemStyle-Wrap="false" />
                <telerik:GridNumericColumn DataField="CommentValue" HeaderText="Comment Value" HeaderStyle-Wrap="false" DataType="System.Decimal" AllowRounding="false" DecimalDigits="2" Aggregate="Sum" FooterText="Total Attendance Score: "/>
                <telerik:GridDateTimeColumn DataField="PunchIn" HeaderText ="Punch In"  SortExpression="PunchIn" HeaderStyle-Wrap="false" DataFormatString="{0:MM/dd/yyyy HH:mm}"/>
                <telerik:GridDateTimeColumn DataField="PunchOut" HeaderText ="Punch Out"  SortExpression="PunchOut" HeaderStyle-Wrap="false" DataFormatString="{0:MM/dd/yyyy HH:mm}"/>
                <telerik:GridCheckBoxColumn HeaderText="Modified" DataField="Modified" HeaderStyle-Wrap="false" />
            </Columns>
     
        </MasterTableView>
    </telerik:RadGrid>

     

  2. Answer
    Eyup
    Admin
    Eyup avatar
    3007 posts

    Posted 04 Nov Link to this post

    Hi Patrick,

    Generally, for hierarchical grid structure you can use:
    <MasterTableView ... RetainExpandStateOnRebind="true">

    For grouping, you can try to change the load mode to Client:
    <MasterTableView ... GroupLoadMode="Client">

    Alternatively, you can use a session collection variable to save the expanded groups and re-apply them after the window is closed:
    http://www.telerik.com/support/code-library/persist-groups-expanded-state-on-rebind

    Regards,
    Eyup
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Patrick
    Patrick avatar
    19 posts
    Member since:
    Jun 2013

    Posted 09 Nov in reply to Eyup Link to this post

    Thank you!   This did exactly what I needed.  It keeps the last expanded group(s) expanded and the users are much happier!
Back to Top