InitializeNewComponent doesn"t work on webcontrol
am 29.01.2008 14:21:24 von andrew2Hy
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