Hi,
In my custom web control I have 2 properties like this :
[DefaultValue(false),
RefreshProperties(RefreshProperties.All)]
public bool FullScreen
{
get
{
object o = ViewState["FullScreen"];
return (o == null) ? false : (bool)o;
}
set
{
ViewState["FullScreen"] = value;
if (value)
{
this.Width = Unit.Percentage(100);
}
}
}
[DefaultValue(typeof(Unit), ""),
RefreshProperties(RefreshProperties.All)]
public override Unit Width
{
get
{
object o = ViewState["ControlWidth"];
return (o == null) ? Unit.Pixel(150) : (Unit)o;
}
set
{
ViewState["ControlWidth"] = value;
if (value.Type == UnitType.Percentage && value.Value != double.Parse("100"))
this.FullScreen = false;
}
}
What I would like :
1) If I set FullScreen true on the designer, then it set
Width to 100%
2) If I set Width other than 100%, then FullScreen is set to
false.
1) works great.
But 2) just don't ! Here is what it does :
If I set FullScreen true, Width is set to
100%, then I set Width back to 70%,
FullScreenIS set to False in the properties window,
BUT it is still True in html code view !!!
And at runtime this is code view property state which is used...
As you can see I use RefreshProperties
attribute, but no success.
I use Visual Studio 2005.
Thanks to help me!
(If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)
Pluginbaby
Contributor
2961 Points
486 Posts
MVP
[.NET 2.0] Property not refreshing in code view with RefreshProperties attribute
May 29, 2006 11:10 AM|LINK
Hi,
In my custom web control I have 2 properties like this :
What I would like :
1) If I set FullScreen true on the designer, then it set Width to 100%
2) If I set Width other than 100%, then FullScreen is set to false.
1) works great.
But 2) just don't ! Here is what it does :
If I set FullScreen true, Width is set to 100%, then I set Width back to 70%, FullScreen IS set to False in the properties window, BUT it is still True in html code view !!!
And at runtime this is code view property state which is used...
As you can see I use RefreshProperties attribute, but no success.
I use Visual Studio 2005.
Thanks to help me!
Laurent Duveau
MVP / MCT / RD
http://weblogs.asp.net/lduveau/