Random content

C

Casper Hornstrup

I need to make a control that can be used like this:

<csite:LocalizedHint id="hint1" runat="server">
<csite:Target>
<a href="http://whereever.net"> my text</a>
</csite:Target>
<csite:Source>
<div class="special1">Click me!</div>
</csite:Source>
</csite:LocalizedHint>

Target and Source should be able to contain any controls and literal
content.
I, however, get the following parser error:

Type 'Localization.Target' does not have a property named 'a'.

How do I change Target and Source to accept anything?

Casper
 
K

Ken Cox [Microsoft MVP]

Coud you use a PlaceHolder control and dynamically add a linkbutton control
to it? You could set the URL and target properties before adding the control
to the PlaceHolder controls collection.

Just an idea.
 
C

Casper Hornstrup

<Source> and <Target> need to contain any valid ASP.NET tags. The a and div
tags are just examples.
 
A

Alessandro Zifiglio

hi casper, what you need to do is create two templates, in your case a target and a source template. Its actually very simple, heres an example from the docs.
what you do is define a template and child controls are in turn defined inline within this template. Dont forget to specify ParseChildren(true) on your main class. Its there on the examples

http://samples.gotdotnet.com/quicks...tes/Template1.src&file=VB\Template1.vb&font=3

More examples here on the main page :
http://samples.gotdotnet.com/quicks.../quickstart/aspplus/doc/webctrlauthoring.aspx

Those examples pretty much cover everything and all you need to know. If you having problems postback ;)
I would have answered sooner, somehow missed this post ;P
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top