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

EXCEL Export Problem - RegisterRequiresViewStateEncryption()

6 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 12 Mar 2009, 06:23 PM
I am not sure why this is happening, but it ONLY happens when exporting to Excel.  I have this same export functionality on other pages that work fine, for some reason this page doesn't like it and I am not sure why.

I specify the file name and format on the grid itself and then simply have these buttons:
<asp:ImageButton ID="btn_ExportCSV" runat="server" 
                OnClick="btn_ExportCSV_Click" BorderColor="#F0A54E"  
                BorderStyle="Ridge"  
                ImageUrl="~/images/export_csv.jpg" />&nbsp;&nbsp;&nbsp;&nbsp; 
            <asp:ImageButton ID="btn_ExportEXCEL" runat="server" 
                OnClick="btn_ExportEXCEL_Click" BorderColor="#F0A54E"  
                BorderStyle="Ridge"  
                ImageUrl="~/images/export_excel.jpg" />&nbsp;&nbsp;&nbsp;&nbsp; 
            <asp:ImageButton ID="btn_ExportWORD" runat="server" 
                OnClick="btn_ExportWORD_Click" BorderColor="#F0A54E"  
                BorderStyle="Ridge"  
                ImageUrl="~/images/export_word.jpg" />         
 Protected Sub btn_ExportEXCEL_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btn_ExportEXCEL.Click 
        ConfigureExport() 
        grid_applications.MasterTableView.ExportToExcel() 
    End Sub 
 
    Protected Sub btn_ExportWORD_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btn_ExportWORD.Click 
        ConfigureExport() 
        grid_applications.MasterTableView.ExportToWord() 
    End Sub 
 
    Protected Sub btn_ExportCSV_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btn_ExportCSV.Click 
        ConfigureExport() 
        grid_applications.MasterTableView.ExportToCSV() 
    End Sub 
 
 
    Public Sub ConfigureExport() 
 
        For x = 2 To 22 'display only columns I want 
 
            grid_applications.MasterTableView.Columns(x).Visible = True 
 
        Next 
 
    End Sub 

When I click CSV or WORD it works fine. When i click Excel Export I get:

The RegisterRequiresViewStateEncryption() method needs to be called before or during Page_PreRender.

Line 131:                BorderStyle="Ridge" 
Line 132:                ImageUrl="~/images/export_word.jpg" />        
Line 133:<telerik:RadGrid ID="grid_applications" runat="server" DataSourceID="sqlds_Applications" 
Line 134:        GridLines="None" Width="1100px" AllowFilteringByColumn="True" 
Line 135:        AllowPaging="True" AllowSorting="True" PageSize="30" ShowGroupPanel="True">




6 Answers, 1 is accepted

Sort by
0
Accepted
Yavor
Telerik team
answered on 16 Mar 2009, 01:41 PM
Hi Shawn,

Attached to this message is a small runnable application with the implementation request by you.
Give it a try and see if it works for you.

For additional information about The RegisterRequiresViewStateEncryption() method needs to be called before or during Page_PreRender error, please refer to this forum.

Best wishes,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Majid Darab
Top achievements
Rank 1
answered on 16 Apr 2010, 04:37 AM
i exactly have the same problem (just for csv - not word or excel)
but the upper answer did not help to get a solution...
i have many radgrids in my pages and they are working perfectly , but i do not know what's the matter about this one ->
i really really do not want to replace it beacause of many works on it
how can i fix this problem?
i am using vs 2008 asp.net web app with c#
thanks a lot

my codes(for export) and my radgrid configuration are correct ...i test them and i finally found the reason of this pro ...
in my radgrid i have three TabStribs (in NestedTemplateView) and in one of them i have a little default vs gridview...
when i remove this gridview problem disappears...
how cani fix this?
0
Majid Darab
Top achievements
Rank 1
answered on 16 Apr 2010, 03:44 PM
is any body home?

0
Yavor
Telerik team
answered on 20 Apr 2010, 01:36 PM
Hi Majid,

The best option in this case would be for you to open a formal support ticket, and send us a small working project, demonstrating your setup, and showing the exception, for additional review and testing.

Kind regards,
Yavor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Majid Darab
Top achievements
Rank 1
answered on 21 Apr 2010, 04:43 AM
i do that ....
0
Bruno
Top achievements
Rank 2
answered on 23 Apr 2010, 04:50 PM
Hi

this is Bruno

if youre remove the datakeynames in gridview the error is gone -

http://www.telerik.com/automated-testing-tools/community/forums/aspnet/grid/grid-export-feature-problem.aspx
Tags
Grid
Asked by
Shawn
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Majid Darab
Top achievements
Rank 1
Bruno
Top achievements
Rank 2
Share this question
or