P
Peeticus
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();
}
}
}
}
}
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();
}
}
}
}
}