How to execute a control defined within the content

J

Jill Graham

Hi,

I have following problem :

My .aspx file contains following html code :



<table id="t1" cellspacing="0" cellpadding="0" runat="server">
<tr>
<td id="HTMLHolder" runat="server">
</td>
</tr>
</table>

The code-behind file fills the HTMLHolder with some text coming from a
database.
content = "This is an example of a link : <myTag:myLink id=test
runat="server">Go to homepage</myTag:myLink>"
HtmlHolder.Controls.Add(New LiteralControl(content))

How can I make the myTag:myLink class to execute ?

(btw... I'm quite new to ASP.NET, so give me some credit)


Jill
 
S

Stanley

Don't put your control in your content string. Try doing it this way.
content = "This is an example of a link : "
dim myTag as New MyLink
myTab.Text = "Go to homepage"
HtmlHolder.Controls.Add(New LiteralControl(content))
HtmlHolder.Controls.Add(myTag)

(note you will have to play with the sytanx a bit to get it right as this is
off the top of my head)

The idea here is that you add your text as a LiteralControl and then add
your link as an object.

-Stanley
 
J

Jill Graham

Hi Stanley,

Thanks for your answer, but this isn't possible in this case.
The content text is built by some end-user who uses an html-editor. He can
enter his text combined with links to other pages and/or documents. And
these links should be verified once the page is built dynamically.

Jill
 

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,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top