GridViewImageColumn and ImageFailed

5 posts, 0 answers
  1. Ludovic Gerbault
    Ludovic Gerbault avatar
    226 posts
    Member since:
    Apr 2009

    Posted 12 Oct 2009 Link to this post

    Hello

    I am using the GridViewImageColumn in my grid to easily display images in my grid.

    As you must know, when you use Images in Silverlight, you often run across the AG_E_NETWORK_ERROR which can occur when the image isn't found, or something else.

    In my case, I'm binding a path to the GridViewImageColumn and I'm using a converter to set the proper Uri for the column, but I can very well have the case where the path is null or set to an empty string.

    And every time, I'm getting in my debbuger a lot of AG_E_NETWORK_ERROR

    So I was wondering, is there something that would help handle ImageFailed event, like the Image object, so I can remove that message.
    And if there isn't, do you plan to add one for the official Q3 release ?

    It would be of great use.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 16 Oct 2009 Link to this post

    Hi,

    I've tried to reproduce this with various invalid approaches including invalid urls, invalid bindings, etc. however didn't get such error. Can you send us small example where this can be reproduced (via support ticket)?

    All the best,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Ludovic Gerbault
    Ludovic Gerbault avatar
    226 posts
    Member since:
    Apr 2009

    Posted 16 Oct 2009 Link to this post

    This is the declaration of the column

     case "7": GridViewImageColumn col7 = new GridViewImageColumn() { Header = row["Name"].ToString(), DataType = typeof(string), DataMemberBinding = new Binding() { Converter = new ImageLinkConverter(), Path = new PropertyPath(path) }, CellStyle = this.Resources["gridviewCellStyle"as Style, UniqueName = path, ImageHeight = 25, ImageStretch = Stretch.Uniform }; 
                                        ClientsGrid.Columns.Add(col7); 
                                        break

    the imagelink converter returns the full path of the image on the server

    basically, the instruction is

    return new System.Windows.Media.Imaging.BitmapImage(new Uri(Application.Current.Host.Source, string.Format("../ImagesArticle/" + Environnement.ENV_Utilisateur.IdSociete + "/{0}", value.ToString()))); 

    The problem is that there can be the case where value.ToString() returns ""

    This is the case where the AG_E_NETWORK_ERROR.

    And usually, I would use the ImageFailed event to set the source to a default no_image.jpg


  5. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 22 Oct 2009 Link to this post

    Hi Subileau Pascal,

    Thank you for the valuable feedback. We will expose this event to the GridViewImageColumn for the official release. Meanwhile you can just check value.ToString() and create appropriate image.

    P.S. I've updated your Telerik points accordingly.

    Greetings,
    Nedyalko Nikolov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 23 Oct 2009 Link to this post

    Hello Subileau Pascal,

    After some discussions within the team we end up with slightly different solution regarding the issue with ImageFailed message.
    We added "ErrorImageSource" property of type Uri to the GridViewImageColumn, the image from this source will be displayed if main source raises ImageFailed event by some reason.
    This new property will be available with the latest internal build related to 2009.Q3 beta later today.
    Hope this helps.

    Kind regards,
    Nedyalko Nikolov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
DevCraft banner