Howto reference non-webcontrols on an ASPX page?

G

Gergely Varadi

Like the <asp:ListBox> and <asp:ListItem> pair, my control use item
definitions, just they are in another assembly:

<mycontrollib:myctrl1>
<Params>
<myitemlib:myitem someattr="someval1">
some text1
</myitemlib:myitem>
<myitemlib:myitem someattr="someval2">
some text2
</myitemlib:myitem>
</Params>
</mycontrollib:myctrl1>

When I drag the control on the page, all the dependencies will be
referenced under the "References" node, but the page will contain <@
Register TagPrefix...> only for 'mycontrollib'.

So Visual Studio throws an exception because it cannot find
'myitemlib'.

2nd problem
-----------

Inserting manually <@ Register TagPrefix...> for 'myitemlib' and
editing the 'Params' collection with the default collection editor, it
puts

<myitemlib.myitem someattr="someval1">...

instead of

<myitemlib:myitem someattr="someval1">...

(Use of period instead of colon.)

Code
----

In 'mycontrollib.dll':

public class myctrl1 : WebControl
{
[PersistenceMode(PersistenceMode.InnerProperty]
public MyItemColl Params
{...}
}

In 'myitemlib.dll':

public class MyItemColl : CollectionBase
{
public int Add(MyItem item)
{...}
public MyItem this[int Index]
{...}
}

public class MyItem : IParserAccessor, IComparable
{
....
}
 

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,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top