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

[Solved] GridBinaryImageColumn zoom onclick

2 Answers 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Henry
Top achievements
Rank 1
Henry asked on 13 Mar 2013, 02:20 PM
I have a radGrid control with that loads a binary image from a sqlDataSource in a GridBinaryImageColumn. It works fine, but I attached an onclick event with code behind, and use a javascript/jquery block code to zoom the image.

The problem is that the image is downloaded using the height/width properties, and when I resize the image, it is grainy, because it was set to resize mode fit. This is great because the image is small so the download is fast.

However, I am using a jQuery Light Box to display the image when it is clicked. Code works fine, except I am using the link from the cell.innerHTML to load the image in a lightbox, and this is the code:

var selectedCell = args.get_gridDataItem().get_cell("UploadPicture");
var image = selectedCell.innerHTML;
var myHref = $(image).attr('src');
 
The src is something like src="Telerik.Web.UI.WebResource.axd?imgid=c7c37cd7e2874a99a04cfe282e769c95&type=rbi"

The image loads fine, however, if I try to resize the image using height/width attributes, the image becomes grainy because the original image that was downloaded was compressed to the settings in the grid control.

Question, is there an easy way to use the Telerik.Web.UI.WebResource.axd?imgid method to call a different size of the same image?

Or, is there an easier way to accomplish this?

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 18 Mar 2013, 11:36 AM
Hi Henry,

You could achieve your scenario by creating a custom image handler by extending the IHttpHandler and request images from the custom handler which will return bigger images to fill your jQuery Light Box. Note that RadGrid does not support such functionality out of the box and custom implementation is required. Additionally, you could take a look at the help article below for more information on how IHttpHandler could be created.

Kind regards,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Henry
Top achievements
Rank 1
answered on 26 Mar 2013, 03:28 PM
Thanks, that's just what i did.
Tags
Grid
Asked by
Henry
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Henry
Top achievements
Rank 1
Share this question
or