Ticket T357302
Visible to All Users

Difficulties when providing a custom image

created 9 years ago

[DevExpress Support Team: CLONED FROM T356223: Not able to get DetailViewItem from LayoutItemTemplateContainer]
Hi,
I use this link
https://documentation.devexpress.com/#eXpressAppFramework/DevExpressExpressAppUtilsImageLoader_CustomGetImageInfotopic
for use custom images but it is getting error in global.asax.cs file for web application.

Please find attachment.

Answers approved by DevExpress Support

created 9 years ago

Hello, Deepak,

There is an error in the ASP.NET example, we will fix it in the next update. The correct code is:

C#
using System.IO; using System.Drawing; using System.Drawing.Imaging; using DevExpress.ExpressApp.Web.Editors.ASPx; // ... ImageLoader.CustomGetImageInfo += (s, args) => { if (args.ImageName.StartsWith(MyWindowController.MyImagePrefix)) { int key; string key_string = args.ImageName.Split('_')[1]; if (int.TryParse(key_string, out key)) { using (IObjectSpace objectSpace = WebApplication.Instance.CreateObjectSpace()) { MyImageObject imageObject = objectSpace.GetObjectByKey<MyImageObject>(key); if (imageObject != null) { args.ImageInfo = new ImageInfo( args.ImageName, Image.FromStream(new MemoryStream(imageObject.Image)), BinaryDataHttpHandler.GetHandlerUrl(ImageProcessorsHelper.GetImageUrl(objectSpace, imageObject, "Image"))); args.Handled = true; } } } } };

You can also find the complete example in attachment.

    Show previous comments (3)
    Dennis Garavsky (DevExpress) 9 years ago

      >>Is  is reflect all places where image used?
      Yes.

      I am afraid we do not provide this solution or others for the old v14.2.7 version. At this stage, I can only recommend you upgrade your components.

        any update please.
        When i change image, image is only change in My action menu but not any other?

        Dennis Garavsky (DevExpress) 9 years ago

          Deepak, would you please help us replicate this behavior in v15.2.7 with the Solution39.zip app my colleague attached previously?
          In my local tests, it replaces the image not only for the Action menu, but also in other places such as the grid and layout. See the attached screenshots.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.