0

I'm using rad controls(charts and gridview) for developing an application,which i need to export the controls(each) into image.I have tried each control converting them into bytes format and send to webservice and converting them to images but sometime sending the byte data to service throws an error.Is any other way to convert each control into image.I have tried another way like.

    Stream fileStream = File.OpenRead(@"\\HARAVEER-PC\TempImages\FlashPivot.png");

        //PART 2 - use the stream to write the file output.
        productChart.ExportToImage(fileStream, new Telerik.Windows.Media.Imaging.PngBitmapEncoder());
        fileStream.Close(); 

It throwing me an error like cannot access to the folder TempImages.I have given sharing permissions to everyone but it doesn't access the folder.

Any solution is much appreciated.

Dinesh Haraveer
  • 1,784
  • 3
  • 31
  • 54

1 Answers1

0
 private BitmapImage CreateChartImages()
    {
        Guid photoID = System.Guid.NewGuid();
        string photolocation = @"D:\Temp\" + photoID.ToString() + ".jpg";  


        BitmapImage bi = new BitmapImage(new Uri(photolocation, UriKind.Absolute));

        using (MemoryStream ms = new MemoryStream())
        {
            radChart.ExportToImage(ms, new PngBitmapEncoder());
            bi.SetSource(ms);
        }
        return bi;
    }
Charly Guirao
  • 489
  • 3
  • 8