Hi,
Wanted to export the data in the Grid (in a user control) to Excel. It's not working. Basically, the File Download dialog with the message "Do you want to open or save this file" itself is not appearing.
So tried to put a test RadGrid like the following. The same method works when it's inside an aspx but not when it's in an ascx.
Why is this? Can you please me with this?
Thanks.
Copying the method which would be called when a button in the aspx or in the ascx is clicked.
Wanted to export the data in the Grid (in a user control) to Excel. It's not working. Basically, the File Download dialog with the message "Do you want to open or save this file" itself is not appearing.
So tried to put a test RadGrid like the following. The same method works when it's inside an aspx but not when it's in an ascx.
Why is this? Can you please me with this?
Thanks.
Copying the method which would be called when a button in the aspx or in the ascx is clicked.
public
void ExportToExcelButtonClick(object sender, EventArgs e)
{
Telerik.Web.UI.
RadGrid gv = new Telerik.Web.UI.RadGrid();
gv.DataSource =
new ArrayList();
gv.ExportSettings.ExportOnlyData =
true;
gv.ExportSettings.IgnorePaging =
true;
gv.ExportSettings.OpenInNewWindow =
true;
gv.MasterTableView.Caption =
"my caption";
gv.ExportSettings.FileName =
"exportGrid";
this.Controls.Add(gv);
gv.DataBind();
gv.MasterTableView.ExportToExcel();
}