Note that there are some explanatory texts on larger screens.

plurals
  1. POImageUrl on Custom Control Design Time
    primarykey
    data
    text
    <p>I have build a Custom Control with an ImageURL property. At design time when I enter an image in the ImageUrl I get the following error message</p> <p>Error Creating Control - AmazeDropDownList1'~/Image/help.png' could not be set on property 'ImageUrl'.</p> <pre><code>&lt;myCompany:MyCompanyDropDownList ID="AmazeDropDownList1" runat="server" ImageUrl="~/Image/help.png"&gt; &lt;/myCompany:MyCompanyDropDownList&gt; </code></pre> <p>The code for my control is shown below:</p> <pre><code> [DefaultValue("")] [Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))] [Description("Image_ImageUrl")] [Bindable(true)] [Category("Appearance")] [UrlProperty] public virtual string ImageUrl { get { string str = (string)this.ViewState["ImageUrl"]; if (str != null) { return str; } return string.Empty; } set { this.ViewState["ImageUrl"] = value; } } </code></pre> <p>I am inheriting from TextBox, below is my render method:</p> <pre><code> protected override void Render(System.Web.UI.HtmlTextWriter writer) { // Call the base class's Render method. base.Render(writer); if (!string.IsNullOrEmpty(this.ImageUrl)) { // Create and render a new Image Web control. System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image(); image.ID = "Image1"; image.ImageUrl = ImageUrl; image.AlternateText = ImageAltText; image.RenderControl(writer); } } </code></pre> <p>I would really appreciate any help in fixing the error message.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload