M
margelos
I have created the following usercontrol
public class RegisterUser : TemplatedWebControl {
private VisFields _vfields = new VisFields();
public VisFields VisibleFields {
get { return _vfields; }
set { _vfields = value; }
}
private bool _showit;
public bool ShowIt {
get { return _showit; }
set { _showit=value;}
}
public RegisterUser() : base() {
}
VisFields is a custom class that has properties of boolean
[TypeConverter(typeof(VisFieldsConverter)), Description("Select Visible
Fields")]
public class VisFields {
private bool _firstQuestion;
private bool _secondQuestion;
[DefaultValue(true)]
public bool FirstQuestion {
get { return _firstQuestion; }
set { _firstQuestion = value; }
}
[DefaultValue(true)]
public bool SecondQuestion {
get { return _secondQuestion; }
set { _secondQuestion = value; }
}
}
if have of also implemented VisFieldConverter
public class VisFieldsConverter : ExpandableObjectConverter {
..
..
..
}
When i drag and drop the control into my webpage, and click on the
property grid, i see the (VisibleFields) property and i can expand it
and see its properties (FirstQuestion,SecondQuestion). I can change
them to true/false, but when i switch to source of design mode, or even
when i run the page, these properties always have their default value.
So the problem is that the control CAN'T keep the changes i make from
design mode. Any ideas??
public class RegisterUser : TemplatedWebControl {
private VisFields _vfields = new VisFields();
public VisFields VisibleFields {
get { return _vfields; }
set { _vfields = value; }
}
private bool _showit;
public bool ShowIt {
get { return _showit; }
set { _showit=value;}
}
public RegisterUser() : base() {
}
VisFields is a custom class that has properties of boolean
[TypeConverter(typeof(VisFieldsConverter)), Description("Select Visible
Fields")]
public class VisFields {
private bool _firstQuestion;
private bool _secondQuestion;
[DefaultValue(true)]
public bool FirstQuestion {
get { return _firstQuestion; }
set { _firstQuestion = value; }
}
[DefaultValue(true)]
public bool SecondQuestion {
get { return _secondQuestion; }
set { _secondQuestion = value; }
}
}
if have of also implemented VisFieldConverter
public class VisFieldsConverter : ExpandableObjectConverter {
..
..
..
}
When i drag and drop the control into my webpage, and click on the
property grid, i see the (VisibleFields) property and i can expand it
and see its properties (FirstQuestion,SecondQuestion). I can change
them to true/false, but when i switch to source of design mode, or even
when i run the page, these properties always have their default value.
So the problem is that the control CAN'T keep the changes i make from
design mode. Any ideas??