Ask a Question related to ASP.NET Building Controls, Design and Development.
-
~~~ .NET Ed ~~~ #1
Parser Error: Type XYZ does not have a property named 'cc3:MyItems' (complete posting) ASP.NET Web Control Error
I am having problems trying to get this part of the functionality working on
my control and I hope somebody has a clue about how to resolve it.
1. How the relevant tags appear on the ASPX page. The @Register stuff is
omitted.
The control is basically a composite who also has a list of items (Items
property), every item that is defined gets
a tag of its own within the tag of the control in the ASPX page:
<cc3:CtPageHeader id="CtPageHeader1" runat="server">
<cc3:CtPageHeaderItem LinkURL="~/this.aspx"
Text="This"></cc3:CtPageHeaderItem>
<cc3:CtPageHeaderItem LinkURL="~/that.aspx"
Text="That"></cc3:CtPageHeaderItem>
</cc3:CtPageHeader>
So far so good. I can drop the control on the design surface, I can select
the Items property which in turn pops up a window to enter the items
(collection editor). As a result the items get inserted in the form as shown
above. The items are within the control's tag (InnerDefaultProperty).
2. This is how the control class has been declared. Notice that it has a
collection to hold the items and a property to access this collection. So
far so good AFAIK.
[DesignerAttribute(typeof(CtPageHeaderDesigner), typeof(IDesigner)),
DefaultProperty("Items"),
ToolboxData("<{0}:CtPageHeader runat=server></{0}:CtPageHeader>")]
public class DocHeader : System.Web.UI.WebControls.WebControl,
INamingContainer
{
// This member contains all the items defined for the control,
private CtPageHeaderLinkItemCollection items = new
CtPageHeaderLinkItemCollection();
[Category("Misc"),
Bindable(true),
NotifyParentProperty(true),
PersistenceMode(PersistenceMode.InnerDefaultProper ty),
Description("The collection of Links and SubLinks")]
public CtPageHeaderLinkItemCollection Items
{
get { return this.items; }
set { this.items = value; }
}
:
}
3. The items that can be added as well as edited with the collection editor
are handled by a class that was declared as shown below (irrelevant code
omitted). For the sake of clarity in this message I am omitting the property
and using public members instead.
public class CtPageHeaderLinkItem : System.Web.UI.Control
{
public string LinkURL;
public string Text;
:
}
Up to here ok. The whole things builds OK. It functions perfectly AS LONG AS
I DO NOT DEFINE ANY ITEMS. As soon as I define items (like the two shown in
point #1) I get the following message on the Designer window for this
particular control:
Error Creating Control - CtPageHeader1
Parser Error: Type 'CtPageHeader does not have a property named
'cc3:CtPageHeaderLinkItem'
When I run the demo page the same error is displayed (obviously) by means of
an exception...
I tried by changing the name of the tags in #1 to "Items" (cc3:Items) in
hopes that it would go away considering there was now a property with the
same name as the inner tags which corresponded to the collection. The
problem still persists,
So, how can I "link" these two things so that these inner properties get
properly mapped (by the parser) to the Items property which is of type
CtPageHeaderLinkItem? I am obviously missing some finer point,
Thanks,
Emilio
~~~ .NET Ed ~~~ Guest
-
String Array Property produces Parser Error
Dear readers, I'm having problems with creating a custom control that accepts an array of strings as a property. First I used the following code... -
Error while using 'ControlState' property in my custom control
My name is Pavan and I am a software engineer working on ASP .Net web development. Currently I am using .Net 2.0 Professional Edition to... -
Error Creating Control: Parser Error DocHeader does not have a property named 'cc3:MyItems'
I am having problems getting this webcontrol working properly. Everything else works fine except having items. So here is the low-down on the... -
Parser Error Message: Could not load type - Please HELP
I have aspx file VS.NET 2002 with c# My application works perfectly on my pc. Please, I need help... THANKS :) ============================= 1) I... -
Error Setting user control property at web form
Dear Friends Hope things goes well to you. I have this problem. Would you please give me your solution? I want to change a property that I... -
~~~ .NET Ed ~~~ #2
Re: Parser Error: Type XYZ does not have a property named 'cc3:MyItems' (complete posting) ASP.NET Web Control Error
No answer yet ? I have searched all over but can't get this error to go away
"~~~ .NET Ed ~~~" <tiredofspam@abolishspam.now> wrote in message
news:OoTXh20xEHA.2016@TK2MSFTNGP15.phx.gbl...on> I am having problems trying to get this part of the functionality workingshown> my control and I hope somebody has a clue about how to resolve it.
>
> 1. How the relevant tags appear on the ASPX page. The @Register stuff is
> omitted.
>
> The control is basically a composite who also has a list of items (Items
> property), every item that is defined gets
> a tag of its own within the tag of the control in the ASPX page:
>
> <cc3:CtPageHeader id="CtPageHeader1" runat="server">
> <cc3:CtPageHeaderItem LinkURL="~/this.aspx"
> Text="This"></cc3:CtPageHeaderItem>
> <cc3:CtPageHeaderItem LinkURL="~/that.aspx"
> Text="That"></cc3:CtPageHeaderItem>
> </cc3:CtPageHeader>
>
> So far so good. I can drop the control on the design surface, I can select
> the Items property which in turn pops up a window to enter the items
> (collection editor). As a result the items get inserted in the form aseditor> above. The items are within the control's tag (InnerDefaultProperty).
>
> 2. This is how the control class has been declared. Notice that it has a
> collection to hold the items and a property to access this collection. So
> far so good AFAIK.
> [DesignerAttribute(typeof(CtPageHeaderDesigner), typeof(IDesigner)),
> DefaultProperty("Items"),
> ToolboxData("<{0}:CtPageHeader runat=server></{0}:CtPageHeader>")]
> public class DocHeader : System.Web.UI.WebControls.WebControl,
> INamingContainer
> {
> // This member contains all the items defined for the control,
> private CtPageHeaderLinkItemCollection items = new
> CtPageHeaderLinkItemCollection();
>
> [Category("Misc"),
> Bindable(true),
> NotifyParentProperty(true),
> PersistenceMode(PersistenceMode.InnerDefaultProper ty),
> Description("The collection of Links and SubLinks")]
> public CtPageHeaderLinkItemCollection Items
> {
> get { return this.items; }
> set { this.items = value; }
> }
> :
> }
>
> 3. The items that can be added as well as edited with the collectionproperty> are handled by a class that was declared as shown below (irrelevant code
> omitted). For the sake of clarity in this message I am omitting theAS> and using public members instead.
>
> public class CtPageHeaderLinkItem : System.Web.UI.Control
> {
> public string LinkURL;
> public string Text;
> :
> }
>
> Up to here ok. The whole things builds OK. It functions perfectly AS LONGin> I DO NOT DEFINE ANY ITEMS. As soon as I define items (like the two shownof> point #1) I get the following message on the Designer window for this
> particular control:
>
> Error Creating Control - CtPageHeader1
> Parser Error: Type 'CtPageHeader does not have a property named
> 'cc3:CtPageHeaderLinkItem'
>
> When I run the demo page the same error is displayed (obviously) by means> an exception...
>
> I tried by changing the name of the tags in #1 to "Items" (cc3:Items) in
> hopes that it would go away considering there was now a property with the
> same name as the inner tags which corresponded to the collection. The
> problem still persists,
>
> So, how can I "link" these two things so that these inner properties get
> properly mapped (by the parser) to the Items property which is of type
> CtPageHeaderLinkItem? I am obviously missing some finer point,
>
> Thanks,
> Emilio
>
>
~~~ .NET Ed ~~~ Guest



Reply With Quote

