The Artima Developer Community
Sponsored Link

.NET Buzz Forum
ImageURLEditor Answer

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jonathan Crossland

Posts: 630
Nickname: jonathanc
Registered: Feb, 2004

Jonathan Crossland is a software architect for Lucid Ocean Ltd
ImageURLEditor Answer Posted: Mar 10, 2004 6:21 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Jonathan Crossland.
Original Post: ImageURLEditor Answer
Feed Title: Jonathan Crossland Weblog
Feed URL:
Feed Description: Design, Frameworks, Patterns and Idioms
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Jonathan Crossland
Latest Posts From Jonathan Crossland Weblog


To implement and use the ImageUrlEditor on a class that does not implement IComponent (which could be any custom class not on the initial webcontrol interface ) - you must create one yourself.

In my case I have a Collection of ImageOverItem and an ImageURL on the class. The standard ImageURLEditor will always fail, as the Site is not available.

It is really simple to get around: here is the code as I have it in a control I am writing.

I add the EditorAttribute


on my ImageURL property, which points to the class below.

using System;
using System.Web.UI.Design;
using System.Drawing.Design;
using System.ComponentModel;

namespace ControlLib.Design
    /// <summary>
    /// Summary description for ImageOverItemEditor.
    /// </summary>
    public class ImageOverItemEditor : UITypeEditor

     string _Caption = "Select Image";
     string _Filter ="Image Files(*.gif;*.jpg;*.jpeg;*.bmp;*.wmf;*.png)|*.gif;*.jpg;*.jpeg;*.bmp;*.wmf;*.png|All Files(*.*)|*.*|";
     UrlBuilderOptions _Options = UrlBuilderOptions.NoAbsolute;
     /// <summary>
     /// Initializes a new instance of the ImageOverItemEditor
     /// </summary>
     public ImageOverItemEditor()
     public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        if (provider!=null)
            object item=null;
            string url="";

            if (context.Instance is ImageOverItem)
             item =((ImageOverItem)context.Instance).Parent;

            if ((item != null) && (item is IComponent))
             url = UrlBuilder.BuildUrl((IComponent)item, null, (string)value, _Caption, _Filter, _Options);
             if (url != null)
                return url;
         return "";


You need to have access to the Parent from the class, I have a Parent property set inside my Collections Add.

Read: ImageURLEditor Answer

Topic: Will it arrive? It will ... Previous Topic   Next Topic Topic: Need to do Demos very fast? Go offline.

Sponsored Links


Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use