I am using the Export facilities of the grid straight out of one of your examples and encountering several different problems. The only option that is working correctly is to export to CSV.
(1) When exporting to Excel, my Excel 2010 is opening and the data is loaded from the grid, but after a few seconds, Excel goes into a loop and I have to kill it from Task Manager.
(2) When exporting to a PDF file, the PDF file never displays but I do receive a new window filled with .net errors. (see attached screen capture.
(3) When exporting to CSV, everything works fine and the data is opened in an Excel spreadsheet which operates fine (no problem).
(4) When exporting to Word, Work 2010 starts to open then hangs (never even shows in Task Manager) and I have to click on "Cancel" on the splash screen to get out of Word.
I have included the code (both display and code-behind) below.
The version being used is 2012.3.1016.45; Windows 8 64-bit, VS2012. SQL Server 2008 R2 Standard.
(1) When exporting to Excel, my Excel 2010 is opening and the data is loaded from the grid, but after a few seconds, Excel goes into a loop and I have to kill it from Task Manager.
(2) When exporting to a PDF file, the PDF file never displays but I do receive a new window filled with .net errors. (see attached screen capture.
(3) When exporting to CSV, everything works fine and the data is opened in an Excel spreadsheet which operates fine (no problem).
(4) When exporting to Word, Work 2010 starts to open then hangs (never even shows in Task Manager) and I have to click on "Cancel" on the splash screen to get out of Word.
I have included the code (both display and code-behind) below.
The version being used is 2012.3.1016.45; Windows 8 64-bit, VS2012. SQL Server 2008 R2 Standard.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
<
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager1"
runat
=
"server"
/>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
//Put your JavaScript code here.
</
script
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
div
>
<
br
/><
br
/>
<
telerik:RadGrid
ID
=
"RadGrid1"
AllowSorting
=
"true"
runat
=
"server"
DataSourceID
=
"SqlDataSource1"
AutoGenerateColumns
=
"false"
Width
=
"100%"
Height
=
"250px"
>
<
ExportSettings
HideStructureColumns
=
"true"
IgnorePaging
=
"true"
OpenInNewWindow
=
"true"
ExportOnlyData
=
"true"
>
</
ExportSettings
>
<
MasterTableView
Width
=
"100%"
CommandItemDisplay
=
"Top"
>
<
CommandItemSettings
ShowExportToWordButton
=
"true"
ShowExportToExcelButton
=
"true"
ShowExportToCsvButton
=
"true"
ShowExportToPdfButton
=
"true"
></
CommandItemSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
DataSourceMode
=
"DataSet"
SelectCommand
=
"SELECT * FROM OfcAgent_List WHERE AgentRecType = 'Agent' AND AgentStatus = 'Active' AND Account = 1"
SelectCommandType
=
"Text"
ConnectionString
=
"Data Source=Lynn-PC;Initial Catalog=BrokerPlus2008_new;user id=sa;password=wheat7211"
></
asp:SqlDataSource
>
<
br
/><
br
/>
</
div
>
</
form
>
</
body
>
</
html
>
using
System;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Data;
using
System.Configuration;
using
System.Web.Security;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
Telerik.Web.UI;
public
partial
class
Default : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
//http://msdn.microsoft.com/en-us/library/w1kdt8w2(v=vs.90).aspx
if
(!Page.IsPostBack)
{
// You can only define the grid columns during page load, do not also do it on postback
DefineGrid();
}
}
private
void
DefineGrid()
{
GridHyperLinkColumn hypercolumn =
null
;
GridBoundColumn boundcolumn =
null
;
hypercolumn =
new
GridHyperLinkColumn();
this
.RadGrid1.Columns.Add(hypercolumn);
hypercolumn.HeaderText =
"Edit"
;
hypercolumn.Text =
"<img border=\"0\" alt=\"View\" src=\"../Icons/pencil_16.png\" />"
;
hypercolumn.DataNavigateUrlFields =
new
string
[] {
"Agent"
};
hypercolumn.DataNavigateUrlFormatString =
"Default2.aspx?K="
+
"{0}"
;
hypercolumn =
null
;
boundcolumn =
new
GridBoundColumn();
this
.RadGrid1.Columns.Add(boundcolumn);
boundcolumn.UniqueName =
"CompanyName"
;
boundcolumn.DataField =
"CompanyName"
;
boundcolumn.HeaderText =
"Company"
;
boundcolumn.Visible =
true
;
boundcolumn =
null
;
boundcolumn =
new
GridBoundColumn();
this
.RadGrid1.Columns.Add(boundcolumn);
boundcolumn.UniqueName =
"OfficeName"
;
boundcolumn.DataField =
"OfficeName"
;
boundcolumn.HeaderText =
"Office"
;
boundcolumn.Visible =
true
;
boundcolumn =
null
;
boundcolumn =
new
GridBoundColumn();
this
.RadGrid1.Columns.Add(boundcolumn);
boundcolumn.UniqueName =
"AgentID"
;
boundcolumn.DataField =
"AgentID"
;
boundcolumn.HeaderText =
"ID"
;
boundcolumn.Visible =
true
;
boundcolumn =
null
;
boundcolumn =
new
GridBoundColumn();
this
.RadGrid1.Columns.Add(boundcolumn);
boundcolumn.UniqueName =
"AgentFullName"
;
boundcolumn.DataField =
"AgentFullName"
;
boundcolumn.HeaderText =
"Name"
;
boundcolumn.Visible =
true
;
boundcolumn =
null
;
boundcolumn =
new
GridBoundColumn();
this
.RadGrid1.Columns.Add(boundcolumn);
boundcolumn.UniqueName =
"AgentCellular"
;
boundcolumn.DataField =
"AgentCellular"
;
boundcolumn.HeaderText =
"Cellular"
;
boundcolumn.Visible =
true
;
boundcolumn =
null
;
boundcolumn =
new
GridBoundColumn();
this
.RadGrid1.Columns.Add(boundcolumn);
boundcolumn.UniqueName =
"AgentEmail"
;
boundcolumn.DataField =
"AgentEmail"
;
boundcolumn.HeaderText =
"Email"
;
boundcolumn.Visible =
true
;
boundcolumn =
null
;
}
}