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

BinaryImage with GridView Templates

3 Answers 61 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Tareq Mahmud
Top achievements
Rank 1
Tareq Mahmud asked on 04 Feb 2010, 02:49 PM
Hi,

I am having trouble to use the Binary Image.
1. Is it possible to use Binary Image insde a Gridview Template column? If yes
Do you have any eaxmples?
2. I am getting employeeID via SQL Query. The image url should be like http://www.xyz.com/employeephotos/xxxxx.jpg where xxxx is the employee ID? How do I bind the the control to point to this link? All photos are stored in employeephotos folder
3. Also I need to resize to to fixed width? Where do I specify? Please help ASAP.

Thanks,

3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 09 Feb 2010, 02:31 PM
Hi Tareq,

Indeed, you can use RadBinaryImage controls for your purpose. In this case you need to set the control ImageUrl property.
For more information on RadBinaryImage properties, please review the below topic:

http://www.telerik.com/help/aspnet-ajax/radbinaryimage.html

All the best,
Iana
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
_Haakon_
Top achievements
Rank 1
answered on 17 Feb 2010, 02:28 AM
I don't understand your tutorials. They always seem to leave out important code bits like the "ImageUrl" settings and where it gets set. I have a RadGrid with a GridBinaryImageColumn and I have an "Image" field in my Sql Database but when I run a query I get all broken images in my grid, all my other columns are showing fine.

What do I need to do to get the images to show up?

Here's my grid:

        <telerik:RadGrid runat="server" ID="rgProducts" >
            <MasterTableView Width="100%">
                <Columns>
                    <telerik:GridBinaryImageColumn DataField="ImageBinary" HeaderText="Image" UniqueName="Upload" ImageAlign="NotSet"
                        ImageHeight="80px" ImageWidth="80px" ResizeMode="Fit"
                        DataAlternateTextFormatString="Image of {0}">
                        <HeaderStyle Width="10%" /> 
                    </telerik:GridBinaryImageColumn>                    
        
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

Here's my DataSource:

    private void LoadData()
    {
        ImagesClassesDataContext dbContext = new ImagesClassesDataContext();

        var query = (from img in dbContext.Images select img);
        rgProducts.DataSource = query;
    }

Here's the Linq Class:

[Table(Name="dbo.Images")]
public partial class Image : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private long _ID;
private System.Data.Linq.Binary _ImageBinary;
private string _ImageType;
private System.Nullable<int> _Height;
private System.Nullable<int> _Width;
private string _AlternateText;
private System.Nullable<long> _ParentID;
}
0
Iana Tsolova
Telerik team
answered on 18 Feb 2010, 03:19 PM
Hello,

Could you please confirm that you have registered the http handler of the RadBinaryImage control either using its Smart Tag or manually in the web.config file to ensure that it will be served as expected when the page is rendered? Namely:

web.config 

<httpHandlers>
    <remove path="*.asmx" verb="*" />
    ......................................................
    <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
</httpHandlers>

Check it out and let me know how it goes.

Best wishes,
Iana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
BinaryImage
Asked by
Tareq Mahmud
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
_Haakon_
Top achievements
Rank 1
Share this question
or