【问题标题】:asp Button is not working after I click on Export to Excel button of RadGrid单击 RadGrid 的导出到 Excel 按钮后,asp 按钮不起作用
【发布时间】:2015-09-08 02:53:41
【问题描述】:

其中有一个RadGridExport to Excel 按钮。在我的 Web 应用程序的一个网页中,RadGrid 之外还有一个 asp Button 和 2 个 DropDowns

2个DropDowns用于过滤aspButton点击时RadGrid的记录。

HTML 代码

<asp:DropDownList ID="ddlMonth" runat="server" Width="207px" AppendDataBoundItems="true">
</asp:DropDownList>

<asp:DropDownList ID="ddlYear" runat="server" Width="207px" AppendDataBoundItems="true">
</asp:DropDownList>

<asp:Button ID="btnSearch" runat="server" Text="Generate" Width="80px" />

 <telerik:RadGrid ID="GridReport" runat="server" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True" ShowGroupPanel="True"
   CellSpacing="0" GridLines="None" Width="100%" Skin="Outlook" DataSourceID="odsMonthlyStatusReport" OnItemDataBound="GridReport_ItemDataBound">

       <ClientSettings AllowDragToGroup="True" />
       <GroupingSettings CaseSensitive="false"></GroupingSettings>
       <MasterTableView AllowFilteringByColumn="true" AllowMultiColumnSorting="false" AutoGenerateColumns="false"
         CommandItemDisplay="Top" DataKeyNames="RequestID" EnableGroupsExpandAll="true" GroupLoadMode="Client" PageSize="50">

         <CommandItemSettings ShowAddNewRecordButton="false" ShowExportToExcelButton="true" />
         <SortExpressions>
           <telerik:GridSortExpression FieldName="RequisitionNo" SortOrder="Descending" />
         </SortExpressions>
         <PagerStyle AlwaysVisible="True" PageSizeControlType="RadComboBox" Position="Bottom" PageSizes="50,100,150,200" />

            <Columns>
               // all columns code
            </Columns>
       </MasterTableView>
       <ExportSettings SuppressColumnDataFormatStrings="True" IgnorePaging="True" ExportOnlyData="True" Excel-Format="ExcelML" OpenInNewWindow="True" FileName="eAP_Report_MonthlyStatus" Excel-FileExtension="xls"></ExportSettings>
 </telerik:RadGrid>

除了点击RadGridExport to Excel 按钮之后,如果我点击asp 按钮(“生成”),一切正常,它根本不起作用。即,在我点击 Export to Excel 之前,asp 按钮将起作用,但在我点击 Export to Excel 后它将不起作用

请让我知道为什么会出现此问题以及可能的解决方案。提前致谢

【问题讨论】:

    标签: asp.net button export-to-excel radgrid


    【解决方案1】:

    找了好久,终于解决了!

    我必须在以下链接中实施第三种解决方法:

    http://www.faisalmb.com/post/Controls-not-functional-after-Export-to-Excel-or-Export-to-PDF-of-Telerik-in-Sharepoint-Application-page.aspx

    这里只是为了让生活更简单;将以下脚本添加到您的 webpart/自定义控件:

    <script type="text/javascript">                         
       //sharepoint postback to work after clicking on telerik export to pdf
       if (typeof (_spBodyOnLoadFunctionNames) != 'undefined' && _spBodyOnLoadFunctionNames != null) {
            _spBodyOnLoadFunctionNames.push("supressSubmitWraper");
         }
    
       function supressSubmitWraper() {
            _spSuppressFormOnSubmitWrapper = true;
         }                      
    </script>
    

    注意:使用 Sharepoint 环境时会出现此问题。

    【讨论】:

      【解决方案2】:
      You do not need code behind to use the embedded export feature of the radgrid. Try to add the page settings and may be also the pdf to check if it works with pdf:
      
      <ExportSettings ExportOnlyData="True" IgnorePaging="True">
        <Pdf PageWidth="210mm" PageHeight="297mm" PaperSize="A4"></Pdf>
        <Excel Format="ExcelML" />
      </ExportSettings>
       if still not working then I think you are using AJAX enabled the grid, so it cannot send the file. Take a look here to see if this is the case and how to fix it: http://www.telerik.com/help/aspnet-ajax/grid-export-with-ajax-enabled.html
      

      然后试试这个链接可能对你有帮助 http://blogs.telerik.com/blogs/14-06-27/new-export-and-import-capabilities-for-asp-net-ajax-suite.

      【讨论】:

      • 感谢您的回复。但是,当我遇到问题时,请再次查看我的问题。我没有在 RadGrid 中使用代码来导出功能,而是在 RadGrid 中使用了&lt;ExportSettings ... &gt; HTML 代码。另外,我检查了建议的链接,但仍然无法解决我的问题。请让我知道问题的原因以及如何解决它。我在发布的问题中粘贴了整个 HTML 代码
      猜你喜欢
      • 1970-01-01
      • 2011-12-25
      • 2015-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多