InitializeNewComponent doesn't work on webcontrol

A

Andrew2

I'm developing a simple webcontrol for testing purpose, but using the
DesignerAttribute and a specific class that override the
InitializeNewComponent, I'm not able to change the webcontrol value of
a new control placed over a web page.

Trying to make a debug doesn't work too since the debug steps into the
web control class and not into the designer one.

I tried also to use the obsolete method OnSetupDefaultValue without
any reuslt.

This is a bit of code:

internal class ControlDesigner :
System.Web.UI.Design.UserControlDesigner
{
public override void InitializeNewComponent(IDictionary
defaultValues)
{
base.InitializeNewComponent(defaultValues);


where I tried to use one of these combination as some sample over the
net shows (msdn included)

PropertyDescriptor prop =
TypeDescriptor.GetProperties(this.Component.GetType()) .Find("StartPage",
false);
prop.SetValue(Component, "1");

or

defaultValues["StartPage"] = "1";

trying for example to pass a string value as well as an integer

Any helps?

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

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top