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

[Solved] Export to Excel issue with Ajax

1 Answer 138 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl Wilkens
Top achievements
Rank 1
Karl Wilkens asked on 14 Jan 2010, 08:43 PM
Hi, I have an Export to Excel button (image button) that sits inside an Ajaxified RadPageView and a mult-tabbed interface and as you guessed by the title, The excel file does not export even though the following code executes without error.

 Protected Sub btnExport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExport.Click
        Dim filename As String
        filename = Membership.ApplicationName.ToString & txtFirstName.Text & "_" & txtLastName.Text & "_" & lblmemberID.Text & "_OrderHistory"
        RadGrid1.ExportSettings.OpenInNewWindow = True
        RadGrid1.ExportSettings.FileName = filename
        RadGrid1.ExportSettings.ExportOnlyData = True
        RadGrid1.ExportSettings.IgnorePaging = True


        RadGrid1.ExportSettings.OpenInNewWindow = True
        RadGrid1.MasterTableView.ExportToExcel()

    End Sub

Does anyone know how I can keep the Ajax but have the export perform as desired? Thanks.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 14 Jan 2010, 09:27 PM
Hello Karl,

Please examine the following links and/or try the code-snippet below:
Export from ajaxified grid topic
Exclude controls from ajaxifying topic
Export RadGrid content to Excel/Word/CSV/PDF with Ajax enabled code-library
Export to PDF demo

<telerik:RadAjaxManager
    ID="RadAjaxManager1"
    runat="server"
    ClientEvents-OnRequestStart="requestStart">
    ....

<script type="text/javascript" language="javascript">
   function requestStart(sender, args)
   {
      if (args.get_eventTarget().indexOf("myExportButtonID") > 0)
         args.set_enableAjax(false);
   }
</script>

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Karl Wilkens
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or