Error: Webcontrol must have items of type X. SubLinks is of type Y

  • Thread starter ~~~ .NET Ed ~~~
  • Start date
N

~~~ .NET Ed ~~~

Hi,
I have made a web control that has two sorts of items. The first is the
Links property that has a persistence attribute of InnerProperty, the other
is SubLinks with the same attribute. Both are of the same collection type.
The control has its own designer class (although it doesn't render in Design
mode like the others I have done, it
still beats me).

The container web control would be in the aspx page as follows (simplified
way)

<cc1:CtPageHeader .....>
</cc1:CtPageHeaderLinkItem>
</SubLinks>
<Links>
<cc1:CtPageHeaderLinkItem LinkURL="url" Text="text"></cc1:MyControlItem>
</Links>
</cc1:CtPageHeader >

When I try to run it I get the following error:

Line 37: <cc1:CtPageHeader id="CtPageHeader1" style="Z-INDEX: 103; LEFT:
24px; POSITION: absolute; TOP: 24px"
Line 38: runat="server" Width="472px"
ConfigPath="e:\WebSites\Config\CtPageHeader.config" EnableViewState="False">
Line 39: <SubLinks>
Line 40: <cc1:CtPageHeaderLinkItem LinkURL="demo.aspx"
LinkItemType="SectionLink" Text="Products"
ID="ctPageHeaderLinkItem1"></cc1:CtPageHeaderLinkItem>
Line 41: <cc1:CtPageHeaderLinkItem LinkURL="about.aspx" Text="About Us"
ID="ctPageHeaderLinkItem2"></cc1:CtPageHeaderLinkItem>


For debugging I tried adding an Add(HtmlGenericControl) overload to the
custom item collection in hopes of catching it (breakpoint) and then reading
the LinkURL & Text attributes of the generic control, but that did not work
as it didn't get there. Where should I be looking? where can I set a
breakpoint for this?
 
N

~~~ .NET Ed ~~~

Nobody has any pointers regarding this problem?

~~~ .NET Ed ~~~ said:
Hi,
I have made a web control that has two sorts of items. The first is the
Links property that has a persistence attribute of InnerProperty, the other
is SubLinks with the same attribute. Both are of the same collection type.
The control has its own designer class (although it doesn't render in Design
mode like the others I have done, it
still beats me).

The container web control would be in the aspx page as follows (simplified
way)

<cc1:CtPageHeader .....>

</SubLinks>
<Links>
<cc1:CtPageHeaderLinkItem LinkURL="url"
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top