or
<script type="text/javascript"> function onRequestStart(sender, args) { if ( (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0) || (args.get_eventTarget().indexOf("ExportToPdfButton") >= 0) ) { alert(args.get_eventTarget()); args.set_enableAjax(false); } }</script><telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdatePanelsRenderMode="Inline"> <ClientEvents OnRequestStart="onRequestStart" /> <AjaxSettings>... <telerik:AjaxSetting AjaxControlID="ReportResultsGrid"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="ReportResultsGrid" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManager><telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel><telerik:RadGrid ID="ReportResultsGrid" runat="server" AllowPaging="True" AllowSorting="True" Height="100%" Width="98%" CellSpacing="0" GridLines="None" ShowGroupPanel="True" OnColumnCreated="ReportResultsGrid_ColumnCreated" AutoGenerateColumns="False" OnNeedDataSource="ReportResultsGrid_NeedDataSource" PageSize="20" OnItemCreated="ReportResultsGrid_ItemCreated"> <ExportSettings OpenInNewWindow="True" ExportOnlyData="True" HideStructureColumns="True" IgnorePaging="True"> <Pdf BorderType="NoBorder" ForceTextWrap="true" PageTopMargin="1.5in" PageBottomMargin="0.5in" PageLeftMargin="0.1in" PageRightMargin="0.1in"> </Pdf> </ExportSettings> <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True"> <Scrolling UseStaticHeaders="True" /> </ClientSettings> <MasterTableView PageSize="25" CommandItemDisplay="TopAndBottom"> <CommandItemSettings ShowAddNewRecordButton="False" ShowExportToExcelButton="True" ShowExportToPdfButton="True" ShowRefreshButton="False" /> <Columns>...[grid bound columns]... </Columns> <PagerStyle Position="TopAndBottom" AlwaysVisible="true" /> <CommandItemStyle HorizontalAlign="Left" /> </MasterTableView> <PagerStyle PageSizes="10;25;50;100;200" Position="TopAndBottom" /></telerik:RadGrid>protected void ReportResultsGrid_ItemCreated(object sender, GridItemEventArgs e){ if (e.Item is GridPagerItem) { var dropDown = (RadComboBox)e.Item.FindControl("PageSizeComboBox"); var totalCount = ((GridPagerItem)e.Item).Paging.DataSourceCount; var sizes = new Dictionary<string, string>() { {"10", "10"}, {"25", "25"}, {"50", "50"} }; if (totalCount > 100) { sizes.Add("100", "100"); } if (totalCount > 200) { sizes.Add("200", "200"); } sizes.Add("All", totalCount.ToString()); dropDown.Items.Clear(); foreach (var size in sizes) { var cboItem = new RadComboBoxItem() { Text = size.Key, Value = size.Value }; cboItem.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID); dropDown.Items.Add(cboItem); } dropDown.FindItemByValue(e.Item.OwnerTableView.PageSize.ToString()).Selected = true; }}protected void ReportResultsGrid_ColumnCreated(object sender, GridColumnCreatedEventArgs e){ if (e.Column is GridBoundColumn) { GridBoundColumn col = (GridBoundColumn)e.Column; if (col.UniqueName == "ID") { col.Visible = false; } }}protected void ReportResultsGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e){ DataTable results = (DataTable)Session[ListReportResultsName]; ReportResultsGrid.DataSource = results;}
| function performSearch() | |
| { | |
| SelectorService.GetData(0,10000000, | |
| ... [snip] ..., | |
| UpdateGrid, SearchFailed); | |
| } | |
| function UpdateGrid(result) | |
| { | |
| var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView(); | |
| tableView.set_dataSource(result); | |
| tableView.dataBind(); | |
| } |
| <asp:Panel ID="GridPanel" runat="server" Style="font-size: x-small; clear: both; | |
| padding: 4px 2px 2px 2px;" ScrollBars="Auto" Height="200px" Width="444px"> | |
| <Telerik:RadGrid ID="RadGrid1" runat="server" SkinID="Selector" EnableViewState="false" | |
| AllowPaging="true" AllowSorting="True" AllowFilteringByColumn="true" GridLines="None" | |
| AutoGenerateColumns="true" OnColumnCreated="RadGrid1_ColumnCreated"> | |
| <ClientSettings> | |
| <ClientEvents OnRowSelected="RowSelected" OnRowDblClick="RowDblClick" /> | |
| <Selecting AllowRowSelect="true" EnableDragToSelectRows="true" /> | |
| </ClientSettings> | |
| </Telerik:RadGrid> | |
| </asp:Panel> |
<telerik:GridTemplateColumn DataField="UserEdited" FilterControlAltText="Filter UserEdited column" HeaderText="UserEdited" SortExpression="UserEdited" UniqueName="UserEdited"> <EditItemTemplate> <asp:Label ID="UserEditedLabel2" runat="server" Text='<%# Bind("UserEdited") %>'></asp:Label> </EditItemTemplate> <ItemTemplate> <asp:Label ID="UserEditedLabel" runat="server" Text='<%# Eval("UserEdited") %>'></asp:Label> </ItemTemplate></telerik:GridTemplateColumn>