locked
Image does not display at Design Time - Custom Web Control RRS feed

  • Question

  • Hi,

    I am developing custom web control DropDownCheckBoxList using Dot NET Framework 2.0 and Visual Studio 2005 IDE. It is derived from DataBoundControl. The control contains an object of Image control, and it also has ImageUrl property which user can assign using Properties dialog in VS Designer.

    The problem is when user assigns ImageUrl, the image is not displayed in DESIGN MODE, though it displays it in run time.

    I do set ImageUrl property of Image control contained in my control and also renders the Image control but it still displays "No Image" icon in Design time.

    Any clue how to solve this?

    The second important problem I'm facing is cursor flickering. My control's image changes on mouseover and mouseout at run time. I have used javascript for that. The problem is, when javascript changes the src attribute of rendered image, cursor flickers. i.e. it flickers between default cursor and default cursor with hourglass. I tried so many things but it just does not work. For your information, I'm using Internet Explorer 6.

    Thanks in advance,

    Regards,

    Hitul Patel

     

    Following is the relevant code from my control.

            [Category("Appearance")]
            [Localizable(true)]
            [Description("The URL of the image to be shown as Drop Down Button.")]
            [Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
            [DefaultValue("")]
            [UrlProperty]
            [Bindable(false)]
            public string ImageUrl
            {
                get
                {
                    return ImageBtn.ImageUrl;
                }

                set
                {
                    ImageBtn.ImageUrl = value;
                }
            }

    Above is the ImageUrl property definition, where ImageBtn is the object of System.Web.UI.WebControls.Image

     

    Wednesday, November 29, 2006 11:55 AM

Answers

  • You're in the wrong forum, this is the .NET BCL forum.  For System.Web, you should post at forums.asp.net.
    Thursday, November 30, 2006 10:57 AM

All replies

  •  

    Hi,

    I just found most important thing. This information will definitely help you to give some solid solution.

    While trying to find the solution, I tried to set ABSOLUTE PHYSICAL PATH of the image to ImageUrl property, and to my surprise it displays the image as expected in DESIGN VIEW. Now, I understood that the problem is of resolving ImageUrl which is relative. e.g. "~/Images/DDCL/ArrowDownOff.gif".

    Now, the problem to resolve relative url in DESIGN MODE is like this. All the url resolving methods like ResolveClientUrl, ResolveUrl or MapPath can resolve the url. But they belong to objects of Page, Application which are null at DESIGN MODE, and I could not find any other way to resolve the relative url to absolute one. Because these objects are live (or not null) at run time, I can resolve the url at run time but not at Design Time.

    So, finally If you do know any way to resolve url at DESIGN TIME, my problem will be solved.

    Thanks in advance,

    Best Regards,
    Hitul Patel

    Thursday, November 30, 2006 6:54 AM
  • You're in the wrong forum, this is the .NET BCL forum.  For System.Web, you should post at forums.asp.net.
    Thursday, November 30, 2006 10:57 AM