I use the following code to export the Radgrid to Excel.It works well before.. but When I used the Try Catch block , the grid is not exporting.. In the Open,Save Cancel whatever I press it didnt respond.If I remove the Try catch it works fine.I used Need datasource too..Please help me. Thanks in Advance.
try
{
RadGrid grdexp = new RadGrid();
RadGridExp.Visible =
true;
DataSet ds = Search();
RadGridExp.DataSource = ds;
RadGridExp.DataBind();
DateTime date = DateTime.Now;
RadGridExp.MasterTableView.Controls.Add(
new LiteralControl("This report was generated on " + date));
RadGridExp.ExportSettings.FileName =
"Test";
RadGridExp.ExportSettings.OpenInNewWindow =
true;
RadGridExp.MasterTableView.ExportToExcel();
}
catch (Exception ex)
{
string rtnstr;
rtnstr =
ExceptionObject.Builderrormsg(this.Page.ToString(), "btnExport_Click", ex.Message);
Exceptionlog.Error(rtnstr);
Session[
"Errmsg"] = ex.Message;
Response.Redirect(
"NoAccess.aspx?Type=2");
}