<
telerik:RadGrid
ID
=
"RadGrid2"
runat
=
"server"
RenderMode
=
"Lightweight"
AllowSorting
=
"true"
>
<
ExportSettings
>
<
Excel
Format
=
"Biff"
/>
</
ExportSettings
>
<
ClientSettings
>
<
ClientEvents
OnCommand
=
"onCommand"
/>
</
ClientSettings
>
<
MasterTableView
AutoGenerateColumns
=
"True"
CommandItemDisplay
=
"Top"
>
<
CommandItemSettings
ShowExportToExcelButton
=
"true"
/>
</
MasterTableView
>
</
telerik:RadGrid
>
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
if
((sender
as
RadGrid).IsExporting)
{
RadGrid grid = sender
as
RadGrid;
GridHeaderItem headerItem = grid.MasterTableView.GetItems(GridItemType.Header)[0]
as
GridHeaderItem;
foreach
(GridColumn col
in
grid.MasterTableView.RenderColumns)
{
headerItem[col.UniqueName].Text = !
string
.IsNullOrEmpty(col.HeaderText) ? col.HeaderText : col.UniqueName;
}
}
}