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

RadBinaryImage with asp:HyperLink

1 Answer 185 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
mihir
Top achievements
Rank 1
mihir asked on 15 Apr 2011, 02:38 PM
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

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 18 Apr 2011, 09:50 AM
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"/>
</asp:HyperLink>

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.

Veli
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.

Tags
BinaryImage
Asked by
mihir
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or