Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
EmbeddableImageRenderer error handling
posted

Hi,

I have an ultragrid whose column's editor is set to a something that inherits from EmbeddableImageRenderer.

I have overrided the GetAutoConvertedDestinationValue() method. The sourceval Object is computed by us and sent to the base method. 

 It looks this way.

Return MyBase.GetAutoConvertedDestinationValue(direction, App.GetAutoConvertedDestinationValue(Me, direction, sourceVal, owner, ownerContext, isValidConversion), destinationType, isValidConversion, owner, ownerContext)

SourceVal computing part throws an exception. What is the best way to handle this?

We tried setting column error and tool tip text to show the error message. Another method we tried was sending IsValidConversion false. But then user wont know why image does not show. Is there a more elegant way to do this?

Thanks

Sowmya

Parents
No Data
Reply
  • 469350
    Offline posted

    I'm not really sure I understand the issue. 
    Are you saying that your code that is trying to convert the sourceValue into an image is raising an exception? Generally speaking, you should try to avoid that if at all possible. The renderer is going to get hit every time a cell in that column paints, which happens a LOT. And an exception, even if handled, will cause a serious performance hit. 

    If the exception is unavoidable, then all you really need to do is make sure you wrap a try...catch around it so it doesn't blow up the application. Presumably you are already doing that because otherwise I don't really understand what you mean about wanting the cell to still show an image, even when it blows up.

    Returning false indicates that the value of the cell could not be converted to the proper type, so that's why the image does not display in that case. 

Children