Hi Telerik,
While Exporting to Excel, i am getting error like
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
I am using the VB Code as bellow
While Exporting to Excel, i am getting error like
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
I am using the VB Code as bellow
| If (Not RadGrid1.MasterTableView.Items.Count = 0) Then |
| With RadGrid1 |
| .ExportSettings.IgnorePaging = True |
| .ExportSettings.ExportOnlyData = True |
| .ExportSettings.FileName = "ExportedResult" |
| .MasterTableView.ExportToExcel() |
| End With |
| End If |
if i'll remove the line " ExportSettings.IgnorePaging = True" , it will work. but i need all the pages to be exported.
in aspx, i am used the code like bellow
| <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AutoGenerateColumns="true" |
| DataSourceID="sqlData1" EnableEmbeddedSkins="False" GridLines="None" |
| EnableAJAX="True" > |
| <HeaderContextMenu EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </HeaderContextMenu> |
| <MasterTableView DataSourceID="sqlData1" AllowFilteringByColumn="false" PageSize="50"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| </Columns> |
| </MasterTableView> |
| <FilterMenu EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </FilterMenu> |
| </telerik:RadGrid> |
| <asp:SqlDataSource ID="sqlData1" runat="server" ConnectionString="<%$ ConnectionStrings:PAMMSConnectionString %>"> |
| </asp:SqlDataSource> |
My grid is creating Dynamically, thats why i used " AutoGenerateColumns="true" ". According to the query user gives , the grid will populate the data.
can you please help me out for this issue.