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

Grid Losing Data in Multiview After When Any View Is Updated

2 Answers 168 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 2
Ron asked on 22 Mar 2013, 02:00 AM

Hello,

I have a strange problem with the behavior of radgrids that are located on different views within a multi-view after any any update is performed within any of the views themselves.  After initially populating the the various grids within the different views, everything looks fine and switching between the views causes no issue.  However, as soon as I do anything that initiates an update it causes all of the radgrids within the various views to lose most of their information and only display partial information of the first line.  I have included screenshot below of what one of the grids looks like after initial databinding and then what it looks like after updating any of the views in the multiview.

I have tried hooking into the NeedDataSourceEvent, but that does not do anything to help the problem.  Additionally, I also tried setting the RenderActiveView mode to both false and true and this did not solve any problems either.  One other thing to note is that I don't even have to update data or controls within one of the views for this to happen.  For instance, if I simply click a button that has code behind to change the view that is currently active, the same problem happens.

Following is the markup for the multiview:

<telerik:RadTabStrip ID="DetailsTabs" runat="server" MultiPageID="DetailViews" SelectedIndex="0">
    <Tabs>
        <telerik:RadTab Text="Summary" Selected="True" />
        <telerik:RadTab Text="Limits" />
        <telerik:RadTab Text="Addresses" />
        <telerik:RadTab Text="Delegates" />
        <telerik:RadTab Text="Groups" />
        <telerik:RadTab Text="OCS" />
        <telerik:RadTab Text="Attributes" />
        <telerik:RadTab Text="Permissions" />
        <telerik:RadTab Text="History" />
        <telerik:RadTab Text="Audit" />
    </Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="DetailViews" runat="server" SelectedIndex="0" RenderSelectedPageOnly="false" CssClass="multi-view">
    <telerik:RadPageView ID="SummaryView" runat="server">
        <asp:DetailsView ID="SummaryGrid" runat="server" AllowPaging="false"
            Width="100%" AutoGenerateRows="false" BorderWidth="0" CssClass="detailsview">
            <FieldHeaderStyle Font-Bold="true" Wrap="false" />
            <Fields>
                <asp:BoundField HeaderText="Display Name" DataField="DisplayName" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Account Name" DataField="AccountName" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Exchange Alias" DataField="ExchangeAlias" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Exchange Server" DataField="ExchangeServer" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Exchange Database" DataField="ExchangeDatabase" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Email Address" DataField="EmailAddress" ItemStyle-HorizontalAlign="Right" />
                <asp:CheckBoxField HeaderText="Account Locked" DataField="AccountLocked" ItemStyle-HorizontalAlign="Right" />
            </Fields>
        </asp:DetailsView>
    </telerik:RadPageView>
    <telerik:RadPageView ID="LimitsView" runat="server">
        <asp:DetailsView ID="LimitsGrid" runat="server" AllowPaging="false"
            Width="100%" AutoGenerateRows="false" BorderWidth="0" CssClass="detailsview">
            <FieldHeaderStyle Font-Bold="true" Wrap="false" />
            <Fields>
                <asp:BoundField HeaderText="Mailbox Size (KB)" DataField="MailboxSize" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Number of Items" DataField="TotalItems" ItemStyle-HorizontalAlign="Right" />
                <asp:CheckBoxField HeaderText="Default Quota Limits" DataField="DefaultQuota" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Issue Warning Limit (KB)" DataField="WarningLimit" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Prohibit Send Limit (KB)" DataField="SendLimit" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Disable Mailbox Limit (KB)" DataField="DisableLimit" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Send Size Limit (KB)" DataField="SendSizeLimit" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Receive Size Limit (KB)" DataField="ReceiveSizeLimit" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Recipient Limit" DataField="RecipientLimit" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Mailbox Status" DataField="MailboxStatus" ItemStyle-HorizontalAlign="Right" />
            </Fields>
        </asp:DetailsView>
    </telerik:RadPageView>
    <telerik:RadPageView ID="AddressesView" runat="server">
        <div>
            <asp:DetailsView ID="AddressesGrid" runat="server" AllowPaging="false"
                Width="100%" AutoGenerateRows="false" BorderWidth="0" CssClass="detailsview">
                <FieldHeaderStyle Font-Bold="true" Wrap="false" />
                <Fields>
                    <asp:BoundField HeaderText="Legacy Address" DataField="LegacyAddress" ItemStyle-HorizontalAlign="Right" />
                    <asp:CheckBoxField HeaderText="Address Hidden" DataField="AddressHidden" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField HeaderText="Forwarding Address" DataField="ForwardingAddress" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField HeaderText="Target Address" DataField="TargetAddress" ItemStyle-HorizontalAlign="Right" />
                </Fields>
            </asp:DetailsView>
        </div>
        <div class="new-block-20">
            <telerik:RadGrid ID="ProxiesGrid" runat="server"
                AutoGenerateColumns="false">
                <MasterTableView CommandItemDisplay="None">
                    <NoRecordsTemplate>
                        <div class="no-records">
                            No records to display.
                        </div>
                    </NoRecordsTemplate>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ProxyAddress"
                            HeaderText="Proxy Address List" />
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </div>
    </telerik:RadPageView>
    <telerik:RadPageView ID="DelegatesView" runat="server">
        <div class="col-50">
            <telerik:RadGrid ID="DelegatesOfGrid" runat="server"
                AutoGenerateColumns="false">
                <MasterTableView CommandItemDisplay="None">
                    <NoRecordsTemplate>
                        <div class="no-records">
                            No records to display.
                        </div>
                    </NoRecordsTemplate>
                    <Columns>
                        <telerik:GridBoundColumn DataField="Delegate"
                            HeaderText="Delegates of this Mailbox" />
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </div>
        <div class="col-50 gutter">
            <telerik:RadGrid ID="DelegatesForGrid" runat="server"
                AutoGenerateColumns="false">
                <MasterTableView CommandItemDisplay="None">
                    <NoRecordsTemplate>
                        <div class="no-records">
                            No records to display.
                        </div>
                    </NoRecordsTemplate>
                    <Columns>
                        <telerik:GridBoundColumn DataField="Delegate"
                            HeaderText="Delegate for these Mailboxes" />
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </div>
    </telerik:RadPageView>
    <telerik:RadPageView ID="GroupsView" runat="server">
        <telerik:RadGrid ID="GroupsGrid" runat="server"
            AutoGenerateColumns="false">
            <MasterTableView CommandItemDisplay="None">
                <NoRecordsTemplate>
                    <div class="no-records">
                        No records to display.
                    </div>
                </NoRecordsTemplate>
                <Columns>
                    <telerik:GridBoundColumn DataField="GroupName"
                        HeaderText="Member of the Following Groups" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </telerik:RadPageView>
    <telerik:RadPageView ID="OCSView" runat="server">
        <asp:DetailsView ID="OCSGrid" runat="server" AllowPaging="false"
            Width="100%" AutoGenerateRows="false" BorderWidth="0" CssClass="detailsview">
            <FieldHeaderStyle Font-Bold="true" Wrap="false" />
            <Fields>
                <asp:CheckBoxField HeaderText="Enabled for OCS" DataField="EnabledOCS" ItemStyle-HorizontalAlign="Right" />
                <asp:CheckBoxField HeaderText="Enabled for Federation" DataField="EnabledFederation" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Primary SIP Address" DataField="SIPAddress" ItemStyle-HorizontalAlign="Right" />
            </Fields>
        </asp:DetailsView>
    </telerik:RadPageView>
    <telerik:RadPageView ID="AttributesView" runat="server">
        <asp:DetailsView ID="AttributesGrid" runat="server" AllowPaging="false"
            Width="100%" AutoGenerateRows="false" BorderWidth="0" CssClass="detailsview">
            <FieldHeaderStyle Font-Bold="true" Wrap="false" />
            <Fields>
                <asp:BoundField HeaderText="Custom Attribute 1" DataField="CA1" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 2" DataField="CA2" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 3" DataField="CA3" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 4" DataField="CA4" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 5" DataField="CA5" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 6" DataField="CA6" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 7" DataField="CA7" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 8" DataField="CA8" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 9" DataField="CA9" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 10" DataField="CA10" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 11" DataField="CA11" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 12" DataField="CA12" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 13" DataField="CA13" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 14" DataField="CA14" ItemStyle-HorizontalAlign="Right" />
                <asp:BoundField HeaderText="Custom Attribute 15" DataField="CA15" ItemStyle-HorizontalAlign="Right" />
            </Fields>
        </asp:DetailsView>
    </telerik:RadPageView>
    <telerik:RadPageView ID="PermissionsView" runat="server">
        <telerik:RadGrid ID="PermissionsGrid" runat="server" AutoGenerateColumns="false">
            <MasterTableView CommandItemDisplay="None">
                <NoRecordsTemplate>
                    <div class="no-records">
                        No records to display.
                    </div>
                </NoRecordsTemplate>
                <Columns>
                    <telerik:GridBoundColumn DataField="User" HeaderText="User or Group" />
                    <telerik:GridBoundColumn DataField="Permissions" HeaderText="Permissions Granted" />
                    <telerik:GridBoundColumn DataField="Type" HeaderText="Permission Type" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </telerik:RadPageView>
    <telerik:RadPageView ID="HistoryView" runat="server">
        <telerik:RadHtmlChart runat="server" ID="HistoryChart" Height="75"
            Transitions="true" DataSourceID="HistoryDataSource" CssClass="chart-100">
            <ChartTitle Text="Exchange Storage Growth">
                <Appearance Visible="false" />
            </ChartTitle>
            <Legend>
                <Appearance Position="Top" />
            </Legend>
            <PlotArea>
                <XAxis MajorTickType="None" MinorTickType="None" DataLabelsField="Date">
                    <LabelsAppearance DataFormatString="{0}" />
                    <TitleAppearance Visible="false" />
                    <MinorGridLines Visible="false" />
                    <MajorGridLines Visible="false" />
                </XAxis>
                <YAxis MajorTickType="None" MinorTickType="None">
                    <LabelsAppearance Visible="false" />
                    <TitleAppearance Visible="false" />
                    <MinorGridLines Visible="false" />
                    <MajorGridLines Visible="false" />
                </YAxis>
                <Series>
                    <telerik:LineSeries DataFieldY="Number">
                        <LabelsAppearance DataField="Server" />
                        <TooltipsAppearance Visible="false" />
                    </telerik:LineSeries>
                </Series>
            </PlotArea>
        </telerik:RadHtmlChart>
    </telerik:RadPageView>
    <telerik:RadPageView ID="AuditView" runat="server">
        <telerik:RadGrid ID="AuditGrid" runat="server"
            AutoGenerateColumns="false"
            AllowPaging="true"
            AllowSorting="true"
            PageSize="25">
            <MasterTableView DataKeyNames="AuditID" HierarchyLoadMode="Client" CommandItemDisplay="None">
                <NoRecordsTemplate>
                    <div class="no-records">
                        No records to display.
                    </div>
                </NoRecordsTemplate>
                <Columns>
                    <telerik:GridBoundColumn DataField="AuditID" HeaderText="Audit ID" />
                    <telerik:GridDateTimeColumn DataField="Date" HeaderText="Date" />
                    <telerik:GridBoundColumn DataField="Application" HeaderText="Application" />
                    <telerik:GridBoundColumn DataField="Action" HeaderText="Action" />
                    <telerik:GridBoundColumn DataField="UserID" HeaderText="User ID" />
                </Columns>
                <PagerStyle
                    Mode="NextPrevAndNumeric"
                    Position="Bottom"
                    />
                <CommandItemSettings
                    ShowAddNewRecordButton="false"
                    ShowExportToExcelButton="true"
                    ShowExportToCsvButton="true"
                    />
                <NestedViewSettings DataSourceID="AuditDetailsDataSource">
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="AuditID" MasterKeyField="AuditID" />
                    </ParentTableRelation>
                </NestedViewSettings>
                <NestedViewTemplate>
                    <asp:Panel runat="server" ID="InnerContainer">
                        <div class="nested-pane pad-20">
                            <h4 class="center-text">Audit Event Details for Event ID# <%#Eval("AuditID")%></h4>
                            <table border="0" cellpadding="0" cellspacing="0" width="100%" class="data-layout">
                                <tr>
                                    <td class="label first-row">Process:</td>
                                    <td class="value first-row"><asp:Label ID="UserID" Text='<%#Bind("Process") %>' runat="server" /></td>
                                </tr>
                                <tr>
                                    <td class="label">Old Value:</td>
                                    <td class="value"><asp:Label ID="OldValue" Text='<%#Bind("OldValue") %>' runat="server" /></td>
                                </tr>
                                <tr>
                                    <td class="label">New Value:</td>
                                    <td class="value"><asp:Label ID="NewValue" Text='<%#Bind("NewValue") %>' runat="server" /></td>
                                </tr>
                                <tr>
                                    <td class="label">Reason:</td>
                                    <td class="value"><asp:Label ID="Reason" Text='<%#Bind("Reason") %>' runat="server" /></td>
                                </tr>
                                <tr>
                                    <td class="label">Case Number:</td>
                                    <td class="value"><asp:Label ID="CaseNumber" Text='<%#Bind("CaseNumber") %>' runat="server" /></td>
                                </tr>
                                <tr>
                                    <td class="label">Details:</td>
                                    <td class="value"><asp:Label ID="Details" Text='<%#Bind("Details") %>' runat="server" /></td>
                                </tr>
                            </table>
                        </div>
                    </asp:Panel>
                </NestedViewTemplate>
            </MasterTableView>
            <ClientSettings EnableRowHoverStyle="true" />
        </telerik:RadGrid>
    </telerik:RadPageView>
</telerik:RadMultiPage>

Thanks,
Ron

2 Answers, 1 is accepted

Sort by
0
Ron
Top achievements
Rank 2
answered on 22 Mar 2013, 12:24 PM
I spoke to early and found the issue.  In the control's init event I had been binding an empty table so when the page loads the Empty Records template will show versus just a flat line for the grid.  I did not realize this was being called whenever the multiview was being updated.  So I simply just put an IF condition in to only bind the empty table on a Page Load and not a Postback.  The strange thing is that even I had only one grid in the multiview wrapped by an update panel through AjaxManager, it still affected all the other tables.

Thanks,
Ron
0
Pavlina
Telerik team
answered on 27 Mar 2013, 12:20 PM
Hello Ron,

I recommend choosing RenderSelectedPageOnly = true for RadMultipage, set AutoPostBack = true for the tabstrip and ajaxify the tabstrip and the multipage via RadAjaxManager as described in the second point of this help article. Thus only the active page view will be loaded at a time and merly the grid object residing in that page view will be bound to data.

Give this suggestion a try and see if it helps.

Kind regards,
Pavlina
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
Ron
Top achievements
Rank 2
Answers by
Ron
Top achievements
Rank 2
Pavlina
Telerik team
Share this question
or