Custom Control Design-Time Issue

Discussion in 'ASP .Net Building Controls' started by Peeticus, Dec 7, 2004.

  1. Peeticus

    Peeticus Guest

    Hello all,
    I have an issue during design-time with an ASP.Net custom control. When
    the user sets a specific property at design-time (the ImageUrl
    property) I want to display a message to the user asking if they would
    like to set another property and create a thumbnail image. This seems
    to work just lovely. The problem I am having is when I build my test
    app that an instance of the control sits on. When I build, the IDE asks
    me again if I would like to set this property value. This should only
    be asked when the user sets the value, not when the IDE decides to
    destroy and recreate my control. I hope I have explained the problem
    properly, this is my first asp.net custom control so please be gentle.
    Pasted below is the code for the specific properties in question.
    Thanks in advance.

    [Bindable(true),
    Category("Appearance"),
    Description("The url of the thumbnail (smaller) image. Note that
    setting the" +
    " ImageUrl property can automatically create the smaller thumbnail"
    +
    " image and set this property value to the URL of the new image."),
    DefaultValue(""),
    Editor(typeof(System.Web.UI.Design.ImageUrlEditor),
    typeof(System.Drawing.Design.UITypeEditor))
    ]
    public string ThumbImageUrl
    {
    get
    {
    return thumbImageUrl;
    }

    set
    {
    thumbImageUrl = value;
    }
    }


    public override string ImageUrl
    {
    get
    {
    return imageUrl;
    }

    set
    {
    if (imageUrl != value)
    {
    imageUrl = value;
    //If design-time...
    if ((HttpContext.Current == null) && (imageExists()))
    {
    MessageBox.Show(this.Parent.ToString());
    MessageBox.Show("imageurl: " + imageUrl + " value: " +
    value);
    if (MessageBox.Show("Would you like me to create the smaller,
    thumbnail image?",
    "Create Thumbnail Image",
    MessageBoxButtons.YesNo) == DialogResult.Yes)
    {
    CreateThumbImage();
    }
    }
    }
    }
    }
     
    Peeticus, Dec 7, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    731
  2. Ravi Ambros Wallau
    Replies:
    0
    Views:
    4,101
    Ravi Ambros Wallau
    Jun 1, 2005
  3. Replies:
    1
    Views:
    394
    Teemu Keiski
    Jul 2, 2003
  4. Peeticus

    Custom Control Design-Time Issue

    Peeticus, Dec 7, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    98
    Peeticus
    Dec 7, 2004
  5. Ravi Ambros Wallau
    Replies:
    0
    Views:
    320
    Ravi Ambros Wallau
    Jun 1, 2005
Loading...

Share This Page