.NET Designer - Image Could Not Be Set On Property Error
If you have a custom server control with a property of type image, it takes some work to make it appear in the designer.
Add these attributes to the property:
[Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
public virtual string ImageUrl
Then, if you get error 'Image Could Not Be Set On Property', you need to ensure that the 'get/set' code of your property do not call code not available in the designer.
For example, a call to VirtualPathUtility would cause the designer to crash. Do any of this processing later, such as on Render.
Or, you can hide the code from the designer with:
if (System.ComponentModel.LicenseManager.CurrentContext.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime)
return; // don't parse data in design mode or it throws an error; can't use DesignMode flag as it's not set in constructor
Created By: amos 5/10/2013 4:51:22 PM
Updated: 9/9/2014 5:47:31 PM