473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Cannot create an object of type 'CustomWizard' from its string representation...

I get the error:

"Cannot create an object of type 'CustomWizard' from its string
representation 'CustomWizard1' for the CustomWizard Property."

when I view my custom server web control in design view. Everything runs
fine when I run the page, it's only design view that gives the error.
My custom server web control is inherited form the wizard control.

In OnInit I add a Child to the wizard, witch is also a custom server web
control I've created (a header in the wizard)

On the child control I've added a "CustomWizard" property in whitch I set
the Wizard control that the Child is a Child of (the header knows what
wizard it's part of).
Now I get the following error in design view:

"Cannot create an object of type 'CustomWizard' from its string
representation 'CustomWizard1' for the CustomWizard Property."

I guess it's because of some kind of serialization or something so I've
added the following attributes to tha CustomWizard property in the child
control:

[System.ComponentModel.Browsable(false)]
[System.ComponentModel.EditorBrowsable(System.Compo nentModel.EditorBrowsableState.Never)]
[System.ComponentModel.DesignerSerializationVisibil ity(System.ComponentModel.DesignerSerializationVis ibility.Hidden)]

But that didn't solve the problem.

Can't you add properties to controls and only use them programatically? What
am I missing?

I've tried adding a typeconverter:
----------------
public class PageControlTypeConverter<TControl: TypeConverter where
TControl : Control
{
// Overrides the CanConvertFrom method of TypeConverter.
// The ITypeDescriptorContext interface provides the context for the
// conversion. Typically, this interface is used at design time to
// provide information about the design-time container.
public override bool CanConvertFrom(ITypeDescriptorContext context,
Type sourceType)
{
if (sourceType == typeof(string))
{
return true;
}
return base.CanConvertFrom(context, sourceType);
}
// Overrides the ConvertFrom method of TypeConverter.
public override object ConvertFrom(ITypeDescriptorContext context,
CultureInfo culture, object value)
{
if (value is string)
{
Page page = (Page)HttpContext.Current.Handler;
TControl c = page.FindControl((string)value) as TControl;
return c;
}
return base.ConvertFrom(context, culture, value);
}
// Overrides the ConvertTo method of TypeConverter.
public override object ConvertTo(ITypeDescriptorContext context,
CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(string))
{
return ((TControl)value).ID;
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
----------------
And adding this attribute to the child controls property:
[TypeConverter(typeof(PageControlTypeConverter<Cust omWizard>))]

But I still get the same error in design view...

Is ther any way to debug the code run to generate design view?

Any help would be much appreciated.

Kind Regards,
Allan Ebdrup
Jul 16 '07 #1
1 5352
I got it to work, some problem with refreshing the dll, i deleted the
reference and added it again and it worked.
Jul 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Hessam | last post by:
Hello, I am designing a .net custom control in VS.net 7.1 and my control exposes an array of strings which are supposed to be the items to show. To do this have declared a private string variable...
1
by: Bo Xu | last post by:
Object of Combination By Bo Xu Introduction A combination of n things, taken s at a time, often referred as an s-combination out of n, is a way to select a subset of size s from a given set of...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
0
by: Hessam | last post by:
Hello, I am designing a .net custom control in VS.net 7.1 and my control exposes an array of strings which are supposed to be the items to show. To do this have declared a private string variable...
2
by: Asaf | last post by:
Hi, I have placed some HTML Input (Radio) controls on my ASP.NET page using VS.NET 2005. After I have set these controls to "Run as server control" and try to run my page I am receiving the...
18
by: Pedro Pinto | last post by:
Hi there once more........ Instead of showing all the code my problem is simple. I've tried to create this function: char temp(char *string){ alterString(string); return string;
2
by: querry | last post by:
Hi all, I need to set the <asp:TableRow> element's HorizontalAlign property to to center in a XSL file. How can I Do that If I use <asp:TableRow runat="Server"...
3
by: Allan Ebdrup | last post by:
I get the error "Error creating control: ID property is not specified" when I view my custom web control in design view. I add the control that gives an error in OnInit like this: ----- foreach...
2
by: srisrisri | last post by:
iam getting this error plz solve this one my html code is <input type="radio" id="rdoOrganization" value="Organization" runat ="server" name="rdoBusinessType" onclick="ShowUserType();"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.