InitializeNewComponent doesn't work on webcontrol

A

Andrew2

Hy

I'm trying to create a simple webcontrol and reading about to change
the value when a control is placed into the IDE, I got into the
InitializeNewComponent method of the UserControlDesigner class.

I tried to implement as follow

public override void InitializeNewComponent(IDictionary defaultValues)
{
base.InitializeNewComponent(defaultValues);
PropertyDescriptor prop =
TypeDescriptor.GetProperties(Component) .Find("StartPage", false);
prop.SetValue(Component, "1");

// or also prop.SetValue(Component, 1);


but in both way I don't see changes to the value when the control is
dragged into a new web page. I tried to move the
base.InitializeNewComponent(defaultValues); at the end of the method,
but also in this case no positive results.

A debug is impossible, at least trying to debug let me enter just in
the OnInit webcontrol method (on in those I place breakpoints). I
think to have followed the right procedure to debug (setup to run a
new VS Instance, press debug, run a new project into the new VS
windows, reference my object and drag into the form).

What could be the problem?

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