The only way that the export will work is if I set IgnorePaging to false, but then all data that is on the other pages do not get exported to the excel. So basically anytime the IgnorePaging is not false, you get the object reference error. Also, if I remove the user control and just leave the empty NestedViewTemplate elements, the export works all the time. Only when the user control (which just contains a RadGrid) is within a NestedViewTemplate do I get the object reference error.
The user control within the nestedviewtemplate is always set to visible = false, however, when you export, the radgrid within the user control, which is always visible = false, has its OnNeedDataSource event fired and after this is when you get the object reference error. Below is the call stack
Using 2010 Q3 Telerik assembly, this problem does not exists and the RadGrid within the user control that exists in the NestedViewTemplate does not have the OnNeedDataSource event fired when exporting.
|
<
telerik:RadGrid ID="RadGridCustomers" runat="server" Width="100%" AllowSorting="true" SkinID="ExpandCollapse"
AllowPaging="true" OnItemDataBound="RadGridCustomers_ItemDataBound" PageSize="20"
OnItemCommand="RadGridCustomers_ItemCommand" OnNeedDataSource="RadGridCustomers_NeedDataSource">
<ExportSettings FileName="RelationshipList" />
<ClientSettings>
<Resizing AllowColumnResize="true" />
</ClientSettings>
<PagerStyle Mode="NextPrevAndNumeric" />
<MasterTableView DataKeyNames="CcnNumber" Name="CcnList">
<NestedViewTemplate>
<tcb:ViewCustomers ID="ViewCustomersByCcn" runat="server" Visible="false" />
</NestedViewTemplate>
<Columns>
<telerik:GridTemplateColumn HeaderText="Relationship Name" DataField="CcnName"
SortExpression="CcnName" HeaderStyle-Width="140px">
<ItemTemplate>
<asp:HyperLink ID="HyperLinkCcnAccountList" runat="server" Target="_blank"
NavigateUrl="#" ToolTip="View Accounts" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</MasterTableView>
</telerik:RadGrid>
Thanks.