其中有RadGrid
个Export to Excel
按钮。在我的Web应用程序的一个网页中,有一个asp Button
以及RadGrid之外的2 DropDowns
。
2 DropDowns
用于在点击asp RadGrid
时过滤Button
的记录。
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>
所有工作正常,但是,在我点击Export to Excel
的{{1}}按钮后,如果我点击asp按钮(“生成”),它根本不起作用。即,在点击RadGrid
之前,asp按钮会起作用,但点击Export to Excel
请让我知道为什么会出现这个问题,以及可能的解决办法。提前致谢
答案 0 :(得分:1)
经过大量搜索解决方案,最后我修好了!
我必须在下面的链接中实现第3种解决方法:
这只是为了让生活更简单;将以下脚本添加到您的webpart / custom控件:
<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环境时会出现此问题。
答案 1 :(得分:0)
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