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

GridViewImageColumn and ImageFailed

4 Answers 171 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ludovic Gerbault
Top achievements
Rank 1
Ludovic Gerbault asked on 12 Oct 2009, 03:08 PM
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.

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 16 Oct 2009, 06:54 AM
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.
0
Ludovic Gerbault
Top achievements
Rank 1
answered on 16 Oct 2009, 07:42 AM
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


0
Nedyalko Nikolov
Telerik team
answered on 22 Oct 2009, 07:33 AM
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.
0
Nedyalko Nikolov
Telerik team
answered on 23 Oct 2009, 11:36 AM
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.
Tags
GridView
Asked by
Ludovic Gerbault
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Ludovic Gerbault
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Share this question
or