RadBinaryImage with asp:HyperLink

2 posts, 0 answers
  1. mihir
    mihir avatar
    6 posts
    Member since:
    Sep 2012

    Posted 15 Apr 2011 Link to this post

    i put rad binary image in asp:hyperlink and disply image from sql server2005 with size 100 X 100 now when i click on image i want to open 500 X 500 size image i give in hyperlink targer="_blank" means display large image on new page 

    as soon as posible please help me for this type of senario 

    tanking You
  2. Veli
    Veli avatar
    2002 posts

    Posted 18 Apr 2011 Link to this post

    Hi mihir,

    To be able to use the image URL RadBinaryImage generates for the displayed image, the binary image itself should be rendered on the page. So, you can use a RadBinaryImage for a small image thumbnail, but to be able to show the large image too, you need a second RadBinaryImage instance. The second instance will be provided the same binary data as the first one, but will have its Width and Height set to a larger value to show a larger image. You can then use a HyperLink and set its NavigateUrl to the ImageUrl property of the larger RadBinaryImage after setting the DataValue:

    <asp:HyperLink ID="Link1" runat="server" Target="_blank">
        <telerik:RadBinaryImage ID="smallImage" runat="server"
            Width="100px" Height="100px" ResizeMode="Fit"/>
        <telerik:RadBinaryImage ID="largeImage" runat="server"
            Width="500px" Height="500px" ResizeMode="Fit" style="display:none"/>

    protected void Page_Load(object sender, EventArgs e)
        byte[] binaryData = (byte[])((DataView)PhotosDS.Select(new DataSourceSelectArguments()))[1][0];
        smallImage.DataValue = binaryData;
        largeImage.DataValue = binaryData;
        Link1.NavigateUrl = largeImage.ImageUrl;

    In the above example, I use a second larger RadBinaryImage inside the hyperlink. The second image has display:none style, but is still rendered, otherwise, the binary image won't show the image. In the code-behind, after specifying the binary image data to the 2 binary images, I set the NavigateUrl of my link to the ImageUrl of the second (large) binary image. Attaching the test page.

    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top