Create a webcontrol

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top