Click here to Skip to main content
15,908,015 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi folks,


<script type="text/javascript">
            function printIt() {
                var win = window.open('', 'popup', 'location=1,status=1,scrollbars=1,width=800,height=600');
                if (win) {
                    var imageControl = document.getElementById('<%=chkImage2.ClientID%>').src;
                    win.document.write('<img src="' + imageControl + '">');
                    win.document.close();
                    win.focus();
                    win.print();
                }
                return false;
            }
        </script>



 <telerik:RadWindow ID="rdwndwPreviewCheck" VisibleOnPageLoad="false" Title="Check Preview"
        Height="630" Width="790"  runat="server" Behaviors="Close" AutoSize="false" Skin="Office2010Blue"
        OpenerElementID="cmdGraficoIstogramma" Modal="true" Overlay="false" Style="width: 790px;
        height: 630px; visibility: visible; left: 236px; top: 361px; z-index: 3001; position: absolute;">
        <Shortcuts>
            <telerik:WindowShortcut CommandName="CloseAll" Shortcut="Esc" />
        </Shortcuts>
        <ContentTemplate>
            <table>
            </table>
            <asp:Image ID="chkImage2" runat="server" ImageUrl="~/CheckPreview.aspx" />
            <br />
            <br />
            <table style="width: 100%;">
                <tr align="center">
                    <td style="width: 580px;">
                        <telerik:RadButton ID="rdPrint"  runat="server" Text="  Print"   Style="position: relative;
                            left: 90px;"   önClick="print"    >
                            <Icon SecondaryIconCssClass="rbPrint" SecondaryIconRight="4" SecondaryIconTop="4" />
                        </telerik:RadButton>
                    </td>
                    <td>
                        <telerik:RadButton ID="CloseRadPrintWindow"  runat="server" Text="Close"  önClientClicked="closeMyRadWindow"
                            Style="position: relative; left: -185px;">
                        </telerik:RadButton>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </telerik:RadWindow>




How to access the above "imageControl" to ..C# code behind technique ..Any one can replay me how to access image and convert that image into Byte[] format ..
Posted
Comments
Mahesh Bailwal 26-Jun-13 7:35am    
In CheckPreview.aspx you must be fetching bytes for the image and using Response.BinaryWrite to send it to browser. Please confirm if I am right.
sairam pamidi 26-Jun-13 7:38am    
I am used CheckPerview.apsx response in the following format

b.Save(p.Response.OutputStream, ImageFormat.Jpeg);
Here "b" is bitmap Image and "p" is page object.

As you already have access to bitmap file in server side you can use following code to convert bitmap file to byte array. Hope this help

 MemoryStream ms = new MemoryStream();
 b.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] bytes =  ms.ToArray();
 
Share this answer
 
In the above type of Question like image getting from the Other Page Response,In that of situation , We assign image to some session variable then access that image data into Our Page ,See the Below code.
C#
/*checkperview.aspx" not current page  */
  b.Save(p.Response.OutputStream, ImageFormat.Jpeg);
  Image Img = b;
  MemoryStream ms = new MemoryStream(imageToByteArray(Img));
  byte[] bytes = ms.ToArray();
  Image previewImage = byteArrayToImage(bytes);
  Session["previewImage"] = previewImage;


/* Here "b" is bitmap image */
/* P is Page */
/*Image is System.Drawing.Image */


Here I am converting Bitmap Image to Jpeg format image ,But I your may not need That conversion ,I need that Why I am Done conversation.

C#
/*Manualcheck.aspx Current Page   */

  Image Img = (Image)Session["previewImage"];

/*Here I am got Image of Other Page,Now I can Do what ever Operation I need it. */


In the Above Question ,I used preview button in that calling the different page .
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900