A
Andrea
I'm trying to create a custom control, but I've some doubt.
I do the following to setup the designer default value
internal class MyControlDesigner : System.Web.UI.Design.ControlDesigner
{
public override void Initialize (IComponent component)
{
if (!base.ViewControlCreated)
{
base.Initialize(component);
MyControl xyz = (MyControl)component;
xyz.Test= "hello baby";
}
and added the [Designer(typeof(MyControlDesigner))] to my class that is inheriting
from WebControl.
When the control is placed on the form for the first time, the default value
are getted as expected.
What I'm not able to understand is why, when I run for the first time the
web page, my control properties display properties value as uninitialized
(null
or 0 according to the Variable type).
If I can see the value in the designer, those value should be theorically
get from the property's get method, so why at run-time the internal properties
will be resetted at run time?
Thanks
Andrea
I do the following to setup the designer default value
internal class MyControlDesigner : System.Web.UI.Design.ControlDesigner
{
public override void Initialize (IComponent component)
{
if (!base.ViewControlCreated)
{
base.Initialize(component);
MyControl xyz = (MyControl)component;
xyz.Test= "hello baby";
}
and added the [Designer(typeof(MyControlDesigner))] to my class that is inheriting
from WebControl.
When the control is placed on the form for the first time, the default value
are getted as expected.
What I'm not able to understand is why, when I run for the first time the
web page, my control properties display properties value as uninitialized
(null
or 0 according to the Variable type).
If I can see the value in the designer, those value should be theorically
get from the property's get method, so why at run-time the internal properties
will be resetted at run time?
Thanks
Andrea