Export to Excel is not working

2 posts, 0 answers
  1. Elavarasan
    Elavarasan avatar
    6 posts
    Member since:
    Feb 2014

    Posted 02 Apr 2014 Link to this post


    I have used a Telerik Radgrid and I have a button to export the content from radgrid to excel. PFB the code I have used on click of the button

    string alternateText = "ExcelML";
    ​RadGrid1.ExportSettings.Excel.Format = (GridExcelExportFormat)Enum.Parse(typeof(GridExcelExportFormat), alternateText);
    RadGrid1.ExportSettings.ExportOnlyData = true;
    RadGrid1.ExportSettings.IgnorePaging = true;
    RadGrid1.ExportSettings.OpenInNewWindow = true;

    While Debugging, it enters the loop and exits successfully without any exception. But still, it doesn't export to an excel. Please help ASAP!
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Apr 2014 in reply to Elavarasan Link to this post

    Hi  Elavarasan,

    I guess that you are ajaxifying the RadGrid because of that your code is not working. The exporting feature of RadGrid works with regular postbacks only. When RadGrid is ajaxified through RadAjaxManager, you would have to explicitly disable the ajax and then try exporting. .To bypass the limitation you can wire the OnRequestStart event of the ajax panel or ajax manager, determine whether the target control is ajaxified and explicitly disable its ajax mode to export with regular postback as follows.

    <script type="text/javascript">
        function OnRequestStart(sender, args) {
            if (args.get_eventTarget().indexOf("RadButton1") >= 0)

Back to Top