For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET Building Controls > February 2005 > Design-time property change on webctl not saved









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Design-time property change on webctl not saved
atip

2005-02-05, 3:58 am

Hi!

I have a WebControl with 2 properties. In the properties window I change
one of them. Internally I would like to set another property to a default
value. When I do this, the first property (the one changed in the properties
window) gets changed and updates the HTML in the page, but the one changed
internally is not saved.


Here's the code:

public class myControl: System.Web.UI.WebControls.Button {
private string _one, _two;

public myControl() : base()
{ /*_*/ }

public string one {
get { return _one; }
set { this.two = value + " and Two!"; _one = value; } }
public string two {
get { return _two; }
set { _two = value; } }
}

If I set "one" in the Properties Window to a value, "two" should be set to
whatever the value of "one" was + " and Two!".
But although property "two" is changed in the properties window, the changes
do not appear in the HTML of the page.

Thanks!

LBushkin

2005-02-06, 3:59 am

tag property one with the following attribute:

[RefreshProperties(RefreshProperties.All)]

"atip" wrote:

> Hi!
>
> I have a WebControl with 2 properties. In the properties window I change
> one of them. Internally I would like to set another property to a default
> value. When I do this, the first property (the one changed in the properties
> window) gets changed and updates the HTML in the page, but the one changed
> internally is not saved.
>
>
> Here's the code:
>
> public class myControl: System.Web.UI.WebControls.Button {
> private string _one, _two;
>
> public myControl() : base()
> { /*_*/ }
>
> public string one {
> get { return _one; }
> set { this.two = value + " and Two!"; _one = value; } }
> public string two {
> get { return _two; }
> set { _two = value; } }
> }
>
> If I set "one" in the Properties Window to a value, "two" should be set to
> whatever the value of "one" was + " and Two!".
> But although property "two" is changed in the properties window, the changes
> do not appear in the HTML of the page.
>
> Thanks!
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com