Hey guys,
Here's the situation.
I have a radgrid with a dropdown box with different ways to export the grid data that also triggers a confirm type form to pop up.
The form asks the user if they want to perform other tasks before exporting: yes or no, then the window is closed and sends an AJAX request to perform either option. But in both cases, although the export method is hit, nothing gets exported. I have had the grid wrapped in an AJAXPanel and not but it hasn't made a difference.
Please help! Thank you
Aaron
Here's the situation.
I have a radgrid with a dropdown box with different ways to export the grid data that also triggers a confirm type form to pop up.
The form asks the user if they want to perform other tasks before exporting: yes or no, then the window is closed and sends an AJAX request to perform either option. But in both cases, although the export method is hit, nothing gets exported. I have had the grid wrapped in an AJAXPanel and not but it hasn't made a difference.
Please help! Thank you
Aaron
| function exportGrid() { |
| $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("ExportGrid"); |
| } |
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="rgAcctTrans" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
| protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) |
| { |
| if (e.Argument == "ExportGrid") |
| { |
| try |
| { |
| string dateExtension = string.Empty; |
| string to = string.Empty; |
| string from = string.Empty; |
| if ((dpFrom.SelectedDate.HasValue) || (dpTo.SelectedDate.HasValue)) |
| { |
| if (dpTo.SelectedDate.HasValue) |
| to = dpTo.SelectedDate.Value.ToString("dd.MM.yyyy"); |
| if (dpFrom.SelectedDate.HasValue) |
| from = dpFrom.SelectedDate.Value.ToString("dd.MM.yyyy"); |
| dateExtension += "." + from + "-" + to; |
| } |
| if ((dpBilledFrom.SelectedDate.HasValue) || (dpBilledTo.SelectedDate.HasValue)) |
| { |
| if (dpBilledFrom.SelectedDate.HasValue) |
| from = dpBilledFrom.SelectedDate.Value.ToString("dd.MM.yyyy"); |
| if (dpBilledTo.SelectedDate.HasValue) |
| to = dpBilledTo.SelectedDate.Value.ToString("dd.MM.yyyy"); |
| dateExtension += ".Billed-" + from + "-" + to; |
| } |
| rgAcctTrans.ExportSettings.ExportOnlyData = false; |
| rgAcctTrans.ExportSettings.FileName = "Transactions" + dateExtension; |
| rgAcctTrans.ExportSettings.IgnorePaging = true; |
| rgAcctTrans.ExportSettings.OpenInNewWindow = false; |
| rgAcctTrans.Columns[0].HeaderStyle.HorizontalAlign = HorizontalAlign.Left; |
| rgAcctTrans.Columns[0].ItemStyle.HorizontalAlign = HorizontalAlign.Left; |
| rgAcctTrans.Columns[1].HeaderStyle.HorizontalAlign = HorizontalAlign.Right; |
| rgAcctTrans.Columns[1].ItemStyle.HorizontalAlign = HorizontalAlign.Right; |
| //rgAcctTrans.Rebind(); |
| switch (ddlExportTo.SelectedValue) |
| { |
| case "Excel": |
| { |
| rgAcctTrans.MasterTableView.ExportToExcel(); |
| break; |
| } |
| case "Word": |
| { |
| rgAcctTrans.MasterTableView.ExportToWord(); |
| break; |
| } |
| case "CSV": |
| { |
| rgAcctTrans.MasterTableView.ExportToCSV(); |
| break; |
| } |
| } |
| ddlExportTo.Items[0].Selected = true; |
| } |
| catch (Exception ex) |
| { |
| lblMessage.Text = "An error has occurred. <br/> " + ex.Message; |
| } } } |