views:

84

answers:

2

Hi,

I am trying to display image, which is dynamically generated on client side with Silverlight, in a new browser window. This is my javascript function:

function PrintImage(img) 
    {            
        var newWin = window.open();
        var locImg = new Image();

        locImg = img;

        newWin.document.write("<img src=" + locImg + "/>");          
    }

img var is a parameter of c# type BitmapImage. Unfortunately I am newbie with javascript. Thanks for replies.

A: 

The best way you can do is to save the dynamically generated image in a folder in server and get the path of the image.

Pass the image path[string] to the function.

rahul
+1  A: 

You can not do that, the only and best option available is display your image in Silverlight Application itself.

Javascript runs on browser, it can not access bitmap images which are CLR/.NET objects.

In case if you want to show it on new window, its better you create a new window, load silverlight application in new window ( a different one) and then create image and display it there.

You can not easily pass objects from one silverlight app to another silverlight app on same browser, however I have not experimented but it may not work correctly.

Akash Kava