BinaryImage with GridView Templates

4 posts, 0 answers
  1. Tareq Mahmud
    Tareq Mahmud avatar
    4 posts
    Member since:
    Feb 2010

    Posted 04 Feb 2010 Link to this post


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

  2. Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 09 Feb 2010 Link to this post

    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:

    All the best,
    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.
  3. Telerik UI for ASP.NET Core is out
  4. _Haakon_
    _Haakon_ avatar
    3 posts
    Member since:
    Feb 2010

    Posted 16 Feb 2010 Link to this post

    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%">
                        <telerik:GridBinaryImageColumn DataField="ImageBinary" HeaderText="Image" UniqueName="Upload" ImageAlign="NotSet"
                            ImageHeight="80px" ImageWidth="80px" ResizeMode="Fit"
                            DataAlternateTextFormatString="Image of {0}">
                            <HeaderStyle Width="10%" /> 

    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:

    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;
  5. Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 18 Feb 2010 Link to this post


    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:


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

    Check it out and let me know how it goes.

    Best wishes,
    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.
Back to Top