InitializeNewComponent doesn"t work on webcontrol
am 28.01.2008 17:30:18 von andrew2I'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