i am facing a problem with grid excel export, after clicking export the grid is disappearing and nothing happean
MasterPage:
<
telerik:RadScriptManager
ID
=
"Main_RadScriptManager"
runat
=
"server"
/>
<
telerik:RadAjaxManager
ID
=
"Main_RadAjaxManager"
runat
=
"server"
>
<
AjaxSettings
></
AjaxSettings
>
<
ClientEvents
OnRequestStart
=
"OnRequestStart"
/>
</
telerik:RadAjaxManager
>
<
telerik:RadFormDecorator
ID
=
"Main_RadFormDecorator"
runat
=
"server"
DecoratedControls
=
"All"
Skin
=
"Office2007"
/>
<
telerik:RadStyleSheetManager
ID
=
"Main_RadStyleSheetManager"
runat
=
"server"
>
</
telerik:RadStyleSheetManager
>
<
telerik:RadCodeBlock
ID
=
"Main_RadCodeBlock"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function OnRequestStart(sender, args) {
if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0) {
args.set_enableAjax(false);
}
}
</
script
>
</
telerik:RadCodeBlock
>
<
asp:UpdatePanel
ID
=
"Master_UpdatePanel"
runat
=
"server"
UpdateMode
=
"Conditional"
>
<
ContentTemplate
>
<
asp:ContentPlaceHolder
ID
=
"Popup_ContentPlaceHolder"
runat
=
"server"
>
</
asp:ContentPlaceHolder
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
ContentPage:
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"Popup_ContentPlaceHolder"
runat
=
"Server"
>
<
telerik:RadSplitter
ID
=
"InnerRadSplitter"
runat
=
"server"
Height
=
"560px"
Width
=
"100%"
Orientation
=
"Horizontal"
ResizeMode
=
"AdjacentPane"
ResizeWithParentPane
=
"true"
Skin
=
"Vista"
>
<
telerik:RadPane
ID
=
"SearchRadPane"
runat
=
"server"
MaxHeight
=
"150"
MinHeight
=
"70"
Scrolling
=
"Y"
Width
=
"100%"
>
<
div
class
=
"panel message info"
>
</
div
>
</
telerik:RadPane
>
<
telerik:RadSplitBar
ID
=
"SearchRadSplitBar"
runat
=
"server"
>
</
telerik:RadSplitBar
>
<
telerik:RadPane
ID
=
"ResultRadPane"
runat
=
"server"
Scrolling
=
"None"
>
<
telerik:RadGrid
ID
=
"grdData"
AllowPaging
=
"false"
AllowSorting
=
"false"
runat
=
"server"
AutoGenerateColumns
=
"false"
Width
=
"100%"
Height
=
"100%"
Skin
=
"Vista"
GridLines
=
"None"
OnItemCreated
=
"grdData_ItemCreated"
OnItemCommand
=
"grdData_ItemCommand"
>
<
ClientSettings
EnableAlternatingItems
=
"true"
EnableRowHoverStyle
=
"true"
>
<
Selecting
AllowRowSelect
=
"true"
/>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
SaveScrollPosition
=
"true"
>
</
Scrolling
>
</
ClientSettings
>
<
ExportSettings
ExportOnlyData
=
"true"
IgnorePaging
=
"true"
OpenInNewWindow
=
"true"
>
<
Excel
Format
=
"ExcelML"
/>
</
ExportSettings
>
<
MasterTableView
AutoGenerateColumns
=
"false"
Width
=
"100%"
CommandItemDisplay
=
"Top"
>
<
NoRecordsTemplate
>
<
div
style
=
"text-align: center; font-weight: bold"
>
NO_INFO_AVLBL</
div
>
</
NoRecordsTemplate
>
<
CommandItemTemplate
>
<
telerik:RadToolBar
ID
=
"ReportGenerator_ToolBar"
runat
=
"server"
Width
=
"100%"
EnableRoundedCorners
=
"true"
EnableShadows
=
"true"
Skin
=
"Vista"
OnButtonClick
=
"ReportGenerator_ToolBar_ButtonClick"
>
<
Items
>
<
telerik:RadToolBarButton
Text
=
"Export"
Value
=
"Excel_Export"
CommandName
=
"ExportGrid"
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
</
CommandItemTemplate
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
telerik:RadPane
>
<
telerik:RadPane
ID
=
"FooterRadPane"
runat
=
"server"
Height
=
"70"
Scrolling
=
"None"
Width
=
"100%"
Locked
=
"true"
>
<
div
class
=
"mainsection buttons-section"
style
=
"margin: 5px;"
>
<
asp:Button
ID
=
"btn_ReportGeneratorRun"
runat
=
"server"
Text
=
"Search"
class
=
"button button-blue"
OnClick
=
"btn_ReportGeneratorRun_Click"
Width
=
"80px"
/>
</
div
>
</
telerik:RadPane
>
</
telerik:RadSplitter
>
</
asp:Content
>
ContentPage Code:
protected
void
grdData_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item.ItemType == GridItemType.CommandItem)
{
RadToolBar ReportGenerator_ToolBar = (RadToolBar)e.Item.FindControl(
"ReportGenerator_ToolBar"
);
RadToolBarItem Excel_Export = ReportGenerator_ToolBar.FindItemByValue(
"Excel_Export"
);
RadScriptManager.GetCurrent(
this
.Page).RegisterPostBackControl(Excel_Export);
}
}
protected
void
ReportGenerator_ToolBar_ButtonClick(
object
sender, RadToolBarEventArgs e)
{
string
ErrorMessage =
""
;
try
{
//---------------------------------------
if
(e.Item.Value ==
"Excel_Export"
)
{
grdData.ExportSettings.FileName = DateTime.Today.ToString(
"dd.MM.yyyy"
);
grdData.ExportSettings.IgnorePaging =
true
;
grdData.ExportSettings.OpenInNewWindow =
true
;
grdData.MasterTableView.ExportToExcel();
}
//---------------------------------------
}
catch
(Exception ex)
{
ErrorMessage += ex.Message;
}
}