This is a migrated thread and some comments may be shown as answers.

File location for radgrid export

1 Answer 183 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Edd
Top achievements
Rank 1
Edd asked on 02 Jul 2014, 05:28 PM
Dear all,

I have a a radgrid in which i export into csv. The problem is I want to export into  a specified folder and not the default location.
How can i achieve. Any help or advice. thanks

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Jul 2014, 07:24 AM
Hi Edd,

Please try the below C# code snippet to achieve your scenario.

C#:
protected void RadGrid1_GridExporting(object source, GridExportingArgs e)
{
    string path = Server.MapPath("~/NewFolder1/MyFile.xls");//specify the folder name
    using (FileStream fs = File.Create(path))
    {
        Byte[] info = System.Text.Encoding.Default.GetBytes(e.ExportOutput);
        fs.Write(info, 0, info.Length);
    }
    Response.Redirect(Request.Url.ToString());
}

Thanks,
Princy.
Tags
General Discussions
Asked by
Edd
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or