473,395 Members | 2,079 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,395 software developers and data experts.

Error creating control: ID property is not specified

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 (WizardStep ws in WizardSteps)
{
CustomWizardStepHeader header = new CustomWizardStepHeader();
header.ID = "CustomWizardStepHeader";
ws.Controls.AddAt(0, header);
}
-----
So I have specified the ID, why do I get the error then?

Kind Regards,
Allan Ebdrup
Jul 13 '07 #1
3 3994
"Walter Wang [MSFT]" <wa****@online.microsoft.comwrote in message
news:sO****************@TK2MSFTNGHUB02.phx.gbl...
Hi Allan,

Is your custom web control a User Control or a Server Control? I assume
you're creating a custom Server Control which inherits from the Wizard
control.
Yes it's a server control.
When you use this customer Server Control on a Web Form, you will
also need to assign the ID property for it. For example:
<snip>

There is an ID assigned to the tag, and everything runs fine when I run the
page, the problem only occurs in design view.
I've added IDs to all the controls that are generated programatically and
now I get a different error (again only in design view not when I run the
page)
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?

Kind Regards,
Allan Ebdrup
--
Try a beta of my free Survey solution that makes heavy use of AJAX at
http://obsurvey.com, feedback is very welcome.
Jul 16 '07 #2
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...

Jul 16 '07 #3
Hi Allan,

I'm not sure if this is caused by the TypeConverter or not. I cannot tell
clearly what might be the cause without reproducing the issue on my side
and see the detailed error messages. Could you please create a reproducible
project and send it to me? Thank you for the trouble.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 17 '07 #4

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

Similar topics

5
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
8
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As...
5
by: Nathan Sokalski | last post by:
When running a page I am working on, I recieve the following error: Cannot use a leading .. to exit above the top directory. I suspect this has something to do with the problem I posted in a...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
2
by: c676228 | last post by:
Hi, I have several user controls like email, phone,ssn etc. each has it's own validation message in its user control already. When I bring all those user controls in an aspx page, I would like to...
0
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub)...
1
by: Allan Ebdrup | last post by:
I have a asp.net v2 website that runs fine on our development server. I have published the website to a stage server and it runs fine, but when I publish it to production I get the following error:...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.